• 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

Log4J and J2EE logging

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic