• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple log4j appenders

 
C Weaver
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to have different appenders in a log4j.xml file and write to the one I want in the code?

I want to have 2 different loggers, 1 that is the normal application log file where all the debug, info, warn, etc. entries go. Then I want to have a detailed log file where I write details about the j2ee call a client made. We would only go to the second log file if there was a question about the data. I would expect the second file to get large quickly so I was going to make it file size specific with 10 generates or so. It would only store a few days worth of information, but that would be enough.

My other thought is if I can't specify which appender I want the log entry written to, I would create a class that allows me to control it based on the call.

Any thoughts?

Thanks,
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of JBoss AS?

In general, the answer is yes, you can have different appenders, and you can configure the detail appender to limit its size.

To log data to a specific appender, use a logger like this:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic