[logback-user] log4j/logback/JCL/SLF4J???

David Vergnaud dvergnaud at yahoo.com
Tue Oct 6 11:19:25 CEST 2009


Hi everyone!

I have a very general question about logging in Java -- I appreciate this being a logback-related list, but I assumed people with lots of experience in this domain would be able to give me the good advice I need :-)

I want to include logging in the framework I'm creating -- this include several different modules that share centralized services like authentication, configuration, and, soon, logging. 

I've tried using log4j, but it didn't really fit my purpose, or rather I couldn't make it fit my purpose -- unresolved bugs and stuff. Be it as it may, I think I have to move on to a new library, only I'm wondering which one I should use. Perhaps someone can help me decide? 

My goal is to have logs written in an abstract, language-independent way (level, timestamp, message ID and name/value parameter pairs), so they can be displayed e.g. in different languages (e.g. in a web interface). For this, I want to use XML as the basis format for the logs. Ideally, logs should be rotated, with each finished file being a valid XML document by itself (i.e. with wrapping tag, would've worked in log4j if the writeFooter() method had been called in FileAppender.closeFile() ). It is quite clear to me that the current log file will probably *not* be a proper XML document (no end tag), but I'll take care of that later. I might also consider being happy with having invalid XML log files (no wrapping tag) and including them in a wrapper file using a SYSTEM entity. I'll see. 

Also ideally, if possible, I'd like to have a system that allows setting the log level on a medium basis -- i.e. have the very same message, from the very same logger, be logged only on channels for which the log level is enabled. For instance, I'd like to be able to use a single logger (in the log4j sense) with one console channel and one file channel, and have the file channel record all levels (debug - error) while the console displays only e.g. info to error. AFAIK this wasn't possible with log4j, as the logging level was defined for each logger, and the logger itself decided for all appenders whether a message should be logged or not. 

I don't mind expanding a bit on an existing library, but I'd like most of the functionality I've just described to be readily available or at least foreseen. Does anyone have a good idea? 

Thanks a lot in advance! 

Pagod



      


More information about the Logback-user mailing list