replace System.out and System.err to slf4 logger #195

Closed
admizh opened this Issue Jul 11, 2015 · 4 comments

Projects

None yet

2 participants

@admizh
Contributor
admizh commented Jul 11, 2015

For convenient logging we need to use sl4j instead System.out/System.err
System.err
serr
System.out
sout

@admizh admizh changed the title from replace System.out and System.err to slf4 loging to replace System.out and System.err to slf4 logger Jul 11, 2015
@asolntsev
Member

Good idea! Let's do it.

@asolntsev asolntsev added this to the 2.20 milestone Jul 11, 2015
@asolntsev
Member

@admizh Why slf4j? I see that Selenium uses java.util.logging.Logger - probably it's good idea to use it in Selenide too?

@admizh
Contributor
admizh commented Jul 19, 2015

@asolntsev you're right, using similar mechanism (like Selenium) for logging is good. Hopefully Java Util Log will be improved in future (Java 9..10)
http://stackoverflow.com/questions/11359187/why-not-use-java-util-logging

@asolntsev
Member

@admizh Uhh, java.util.logging is unbelievably inconvenient!
I have migrated System.out to java.util.logging, but logging is now just worther. :(

Every Selenide user needs to configure jul properly in order to get more or less readable logs. :(

By default Selenide will generate logs like this:

Jul 25, 2015 10:48:21 PM com.codeborne.selenide.impl.WebDriverThreadLocalContainer createDriver
INFO: Create webdriver: 1 -> FirefoxDriver: firefox on MAC (3e54e3de-b212-2a45-93ad-712aae6ee853)

just for comparison, this is how log4j logs look like:

22:48:15,080 [job main] INFO  DatabaseState - Stored initial database state to tmp/tests.backup.237121905005272_30360@Andreis-MBP-2.sql
22:48:50,707 [6d5-4] INFO  request - Security.fakeLogin 0:0:0:0:0:0:0:1 c2be7b00-27d9-4fe3-95ab-f5da44d4f76c Desktop c-private username=bob representeeIndex=0  url=/bank/overview -> Redirect /bank/overview 213 ms
22:48:51,700 [6d5-5] INFO  request - Bank.overview 0:0:0:0:0:0:0:1 c2be7b00-27d9-4fe3-95ab-f5da44d4f76c Desktop c-private  -> RenderTemplate 951 ms
@asolntsev asolntsev closed this Jul 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment