Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Logging API with JSF  RSS feed

 
Robert James Liguori
Author
Ranch Hand
Posts: 587
6
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use the Java Logging API with JSF, but I'm having problems keeping the loggers unique to the sessions.

I'm using unique file names (embedded dates), but whenever a new session is started, the messages are logged to all of the existing file handles.

I'm going to try to resolve the issue tomorrow... but was looking for a heads up as to the cleanest way to implement the Java Logging API with JSF.

Note: I actually, wish to have an application level logger as well... that should be easier.

Any advice or direction would be appreciated. Are there any good articles on Logging with JSF? Does a framework support a better logger (i.e. Seam)?

As you can see, I really haven't started my homework yet....

Any heads up though, would be appreciated.

Thanks,
Robert
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually use either the built-in Java logger or Log4J. There is nothing special about using them or any other logger with JSF.

If I understand you correctly, you wanted to log on a per-user basis. I've never had a need to do so - I log for the entire application, so all I do is invoke the factory and build a static and/or member logger for the classes I want to report on.

To route per-user, you'd probably have to do something like construct a logger manually and store it in a session object, then log to it. Shouldn't be very hard, just not something I've done.
 
Robert James Liguori
Author
Ranch Hand
Posts: 587
6
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the best place to invoke the factory for an application-level logger? Config file, application listener?
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just put this in the class I want to log.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!