Re: how to Ignore log statements from some modules

2008-09-10 Thread Aneez Backer

hi

I got it working. I removed ".*" after "org.thirdparty".


 

 


Thanks

Aneez
--
Get everybody talkin' about your blog! Get the Free Tell-A-Friend widget
for your blog/site at http://tellafriend.socialtwist.com.


- Original Message - 
From: "Aneez Backer" <[EMAIL PROTECTED]>

To: "Log4J Users List" 
Sent: Thursday, September 11, 2008 11:30 AM
Subject: Re: how to Ignore log statements from some modules


I tried two configurations, but it still shows the debug statements of the 
thirdparty lib.


I tried this first:
-

 




 
 



 
 

- 


And then, I tried the this:

-

 

 



 
 



 
 

-


Both of them do not work. Is there some error in the configuration ??

Thanks

Aneez Backer

--
Get everybody talkin' about your blog! Get the Free Tell-A-Friend widget
for your blog/site at http://tellafriend.socialtwist.com.


- Original Message - 
From: "Curt Arnold" <[EMAIL PROTECTED]>

To: "Log4J Users List" 
Sent: Thursday, September 11, 2008 10:57 AM
Subject: Re: how to Ignore log statements from some modules




On Sep 11, 2008, at 12:15 AM, Aneez Backer wrote:


hi

I am using a third party library for my application. I wish to  ignore 
the log statements originating from this library, but at the  same time 
I wish to log the statements for the classes I have  written. What 
should be done in the log4j.xml file to achieve this ??


Thanks,

Aneez


If the third party library uses logger names like 
"com.example.foolib", then set the level of "com.example.foolib"  to 
OFF (or likely better ERROR) and the level of the root logger to  the 
level of interest in your own class, or you could set the root  logger to 
OFF or ERROR and set the level of "net.example.myapp" to  DEBUG or INFO.


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



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



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



Re: how to Ignore log statements from some modules

2008-09-10 Thread Aneez Backer
I tried two configurations, but it still shows the debug statements of the 
thirdparty lib.


I tried this first:
-

 




 
 



 
 

- 


And then, I tried the this:

-

 

 



 
 



 
 

-


Both of them do not work. Is there some error in the configuration ??

Thanks

Aneez Backer

--
Get everybody talkin' about your blog! Get the Free Tell-A-Friend widget
for your blog/site at http://tellafriend.socialtwist.com.


- Original Message - 
From: "Curt Arnold" <[EMAIL PROTECTED]>

To: "Log4J Users List" 
Sent: Thursday, September 11, 2008 10:57 AM
Subject: Re: how to Ignore log statements from some modules




On Sep 11, 2008, at 12:15 AM, Aneez Backer wrote:


hi

I am using a third party library for my application. I wish to  ignore 
the log statements originating from this library, but at the  same time I 
wish to log the statements for the classes I have  written. What should 
be done in the log4j.xml file to achieve this ??


Thanks,

Aneez


If the third party library uses logger names like 
"com.example.foolib", then set the level of "com.example.foolib"  to 
OFF (or likely better ERROR) and the level of the root logger to  the 
level of interest in your own class, or you could set the root  logger to 
OFF or ERROR and set the level of "net.example.myapp" to  DEBUG or INFO.


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



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



Re: how to Ignore log statements from some modules

2008-09-10 Thread Curt Arnold


On Sep 11, 2008, at 12:15 AM, Aneez Backer wrote:


hi

I am using a third party library for my application. I wish to  
ignore the log statements originating from this library, but at the  
same time I wish to log the statements for the classes I have  
written. What should be done in the log4j.xml file to achieve this ??


Thanks,

Aneez


If the third party library uses logger names like  
"com.example.foolib", then set the level of "com.example.foolib"  
to OFF (or likely better ERROR) and the level of the root logger to  
the level of interest in your own class, or you could set the root  
logger to OFF or ERROR and set the level of "net.example.myapp" to  
DEBUG or INFO.


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



how to Ignore log statements from some modules

2008-09-10 Thread Aneez Backer

hi

I am using a third party library for my application. I wish to ignore the 
log statements originating from this library, but at the same time I wish to 
log the statements for the classes I have written. What should be done in 
the log4j.xml file to achieve this ??


Thanks,

Aneez
--
Get everybody talkin' about your blog! Get the Free Tell-A-Friend widget
for your blog/site at http://tellafriend.socialtwist.com. 



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



James Matz is out of the office.

2008-09-10 Thread James . Matz

I will be out of the office starting  09/10/2008 and will not return until
09/15/2008.

I will respond to your message when I return.


-
This communication may contain proprietary and/or confidential
information and is the property of The Western Union Company or its
affiliates.  If you are not the intended recipient, you are hereby
notified that any use of the information contained in or
transmitted with the communication or dissemination, distribution,
or copying of this communication is strictly prohibited.  If you
have received this communication in error, please notify the
Western Union sender immediately by replying to this message and
delete it from your computer.  

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



RE: static log4j configuration statement

2008-09-10 Thread Michael Erskine
> I use standard static code to include the log4j configuration:
>
> static {
> PropertyConfigurator.configure("file"));
> }
>
> But this code is not always executed, depending on if the class in which
> this is included particpates in execution. But if I add this statment to
> other classes too,
> I sooner or later get double-messages as two classes with this statement
> are used. Then I need to manually remove the code in one of them to
> achieve proper logging.
>
> How this is done right? I just want to have this configuration stated
> once and applicable to the whole project.

Hi Sebastian,

What I tend to do is have a class to do something similar but first check 
whether already configured: my class is called LogConfigureCheck and is used in 
a static block for all my JUnit tests thus...

static {
LogConfigureCheck.check();
}

...and here follows a version of the class suitable for redistribution.

Enjoy,
Michael Erskine


import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;

/**
 * Occasionally we find a JUnit test suite or test case class that tests classes
 * that use log4j but for whatever reason log4j is not configured. We want to
 * avoid log4j being configured multiple times as this adds its own problems!
 * The aim here is to enforce that log4j is configured once and only once with
 * typical but useful features.
 *
 * @author Michael Erskine (msemtd)
 */
public class LogConfigureCheck {
public static void check() {
// One indicator of log4j not being configured is the lack of appenders
// for the root logger. So...
if (!Logger.getRootLogger().getAllAppenders().hasMoreElements()) {
// Here we could just use BasicConfigurator.configure()
// but the layout is not as useful as it could be - here we do
// essentially the same but with a better layout...
Logger.getRootLogger().addAppender(
new ConsoleAppender(new PatternLayout(
"%-5p %d{HH:mm:ss.SSS} %c [%t] %m%n")));
}
}
}


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



static log4j configuration statement

2008-09-10 Thread s . mayer

Hi all,

I use standard static code to include the log4j configuration:

static {
   PropertyConfigurator.configure("file"));
}

But this code is not always executed, depending on if the class in which 
this is included particpates in execution. But if I add this statment to 
other classes too,
I sooner or later get double-messages as two classes with this statement 
are used. Then I need to manually remove the code in one of them to 
achieve proper logging.


How this is done right? I just want to have this configuration stated 
once and applicable to the whole project.


Thanks for help!
Sebastian

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