I've been working on some web applications that make heavy use of printStackTrace(), or System.err.println(...) for error messages.
Is this common in real programs? I've found it difficult to work with because all messages go to the same file without any date/time or usernames so it's difficult to tell which messages go together or where they come from. These files also fill up with junk/debugging output which make it difficult to find important information in them.
There seems to be many different logging libraries for
Java. Would SLF4J work well? It seems to have compatibility with some of the other libraries so it looks quite flexible. I would probably use Logback or Log4J along with it.
Does anyone use the Mapped Diagnostic Context features of these libraries? Adding username and ip addresses to the messages would be useful. Anything else?
Also, how would you view the log files? Do you log to a database, or use any specific programs?