• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple logging config?

 
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm looking for a simple logging config. I would like to use slf4j. I consider log4j overkill for what I'm currently doing. I actually just need a log file containing the style the Tomcat logs use, probably capturing System.out and System.err calls. I currently prefer configuring the Sun JDK logging, but that's not necessarily final.

I once used Commons Logging which I want to dump because of its classloading problems. IIRC Commons Logging was easy to configure, at least I can remember stdout_-date-.log and stderr_-date-.log files in tomcat/logs. I already use embedded JBoss, Hibernate and Seam so there's already a log4j.xml in tomcat/lib, but I doubt I really need the more complicated logging system, so I was looking if I can get these log files to go without Commons Logging.

The question is: Is the JDK 1.4 logger any simpler to configure than log4j or logback? Am I mistaken? After all, I can't find any simple examples other than already slightly complicated http://www.javapractices.com/topic/TopicAction.do?Id=143. Then I can go for log4j or logback right away, what do you think?

Karsten
 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For anybody interested in Windows localhost setups without installer using Tomcat as Windows service:

if you are wondering why your System.out and System.err prints aren't captured and/or Hibernate doesn't print to any logs even though you have set you must have set a correct logging path under the Logging tab (start tomcatw.exe as ADMIN!). Setting the path plus stdout and stderr to auto will create the stdout_ and stderr_ log files (server restart) that you and Hibernate will write to...

It doesn't however answer my original question.

Karsten
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
slf4j isn't a logger. It's a logging integrator that allows complex apps that use multiple logging facilities to get them all merged down into one consistent logging subsystem. Hibernate uses it.

I often use the JRE builtin logger, sometimes known as "juli" (for java utilities logging interface). However, its main drawback is that by default it looks in the JVM for the log configfile. Log4j uses a config file that's located in the app classpath, and that generally works better for webapps (for me, anyway). Then again, juli is built-in. No need to add a separate logging class jarfile.

I don't consider either of them especially hard to install or configure. My own preference is to use the xml config file format for Log4j. In fact, I think I have to to use the rolling logfile appenders.
 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know SLF4J just integrates. I agree that JULI's main drawback is the place where it looks for the config file. I'll finally give LOG4J a shot.

Thanks
Karsten
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic