• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Log4J Query

 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I have incorporated log4j (1.2.13)in my web application (which uses Struts 1.2). I have added log statements in one of the Custom Action class for testing purpose only& its logging properly at desired location in a log file..I am using FileAppender with some conversion pattern.
Now the issue is, I was expecting log statements from my Action class only whereas its logging everything(log statements from Struts specific classes like RequestProcessor etc.) into same log file.
What i need is log from my classes only, can you help me to achieve the same?

Shriniwas
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To turn off logging of the other packages, you will have to do something like:


This is just an example for turning off logging of Struts
 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks first of all.
Small doubt.:
Where i will write this?

I am using log4j.properties file
Shriniwas
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use log4j.xml. In case you are using log4j.properties then the syntax for the same is as follows:

 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Buddy!!!
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set the additivity to fasle , then this will only add to the current appender not to the parent appenders.
But from the previous post i guess that you have already fixed this..My fix is for .4 version of log4j..in which category class has been depricated..the only availabel public class is Logger.
 
reply
    Bookmark Topic Watch Topic
  • New Topic