• Post Reply Bookmark Topic Watch Topic
  • New Topic

Log4J and J2EE logging  RSS feed

 
Keith Shacks
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a requirement to use log4j for logging for my J2EE App. Using Log4j is not the problem though..The problem lies with the requirement that every client should have a separate log file - somethhing like {host_name}abc.log on the server.
Can anyone share some tips/code samples as to how that can be achieved.
Thanks a ton
Keith
 
john smith
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can programmatically configure which appender you want to use per client (have a look at the PropertyConfigurator.doConfigure method to see what log4j expects). IMHO though this is asking for trouble - using logging in this way means your entire J2EE app has to be threadsafe, and you open your server up to being swamped with lots of small log files. A better idea, I think, would be to write an appender that outputs to one file in XML, include the username/id as part of each logged node and write a XSLT to get a view of the log by username.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!