True, I think I should've explained my situation more...
We are using commons Façade for logging. So, my ability to interact direct
log4j is pretty limited.

I'm trying to find a good example of a log4j.xml explain me how to-do this.
 
Thanks

-----Original Message-----
From: Michael Coughlan [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 23, 2004 9:28 AM
To: [EMAIL PROTECTED]
Subject: RE: component level log

> Hello team,
> I'm starting with log4j here, I got a situation in my 
> project.. I appreciate
> any of your suggestion. 
> I got many core components in my app... Let's say 
> org.myapp.security.*
> org.myapp.admin.*
> org.myapp.navigation.* 
> I like to get each of the component logs at different 
> priority and different

Log 4j was designed to do exactly that.

Have you built a hello world program yet?

The constructors will show you how to control logging granularity.

I am new as well. Here's a program I wrote. 

Pay attention to all the object that are necesasry to instanciate the
logger. 

Play with their settings to achieve your desired output control.

I hope that helps.

MPC


public class TestLogger {
        static Logger myLogger = Logger.getLogger("TestLogger");
        
        public static void main(String[] args) {
                File myFile = null; 
                FileOutputStream myFileOS = null;
                PatternLayout myLayout = null;
                WriterAppender myAppender = null;
                
                System.out.println("Writing to file...");
                try {
                    myFile = new File("foo.out");
                        myFileOS = new FileOutputStream (myFile);
                }catch (Exception e) {
                        System.out.println(e.toString());
                }
                myLayout = new PatternLayout("%m%n");
                myAppender = new WriterAppender(myLayout, myFileOS);
                myLogger.addAppender(myAppender);
                myLogger.setLevel(Level.DEBUG);
                myLogger.debug("Hello World with a patternLayout");
        }
} 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to