logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender Heri" <HBen...@Ergonomics.ch>
Subject AW: log4j help: disabling org.apache.commons.digester.Digester logs
Date Mon, 26 Jan 2009 12:29:33 GMT
In your log4j Config, define a subordinated Logger with a higher log level, e.g. INFO:

    <logger name="org.apache.commons.digester.Digester" additivity="false">
        <level value="info"/>
        <appender-ref ref="Console"/>
    </logger>

To have the log statements of this class only logged at level INFO or higher

Or

    <logger name="org.apache.commons" additivity="false">
        <level value="info"/>
        <appender-ref ref="Console"/>
    </logger>

To have the log statements of the whole package org.apache.commons logging at level INFO or
higher

Important is the additivity attribute. If set to false, parent loggers are not involved into
the logging work. If you omit this attribute, the additivity is per default true, which causes
the log framework to pass a log event also to the loggers higher within the logger hierarchy.

Heri


-----Urspr√ľngliche Nachricht-----
Von: Ravi [mailto:ravinm@cox.net] 
Gesendet: Montag, 26. Januar 2009 12:38
An: Log4J Users List
Betreff: log4j help: disabling org.apache.commons.digester.Digester logs

Hi: I am trying to use log4j for the first time to perform logging. I am having one trouble.
I want the java application to print some stuff within my code. But it also prints a lot of
stuff related to org.apache.commons.digester.Digester in addition to my log statements [DEBUG
[main] checkRequest (checkRequest.java)]. The application name is checkRequest. Is there anyway
to dsiable the org.apache.commons.digester.Digester logs?

Here's what I have in the log4j.xml
========================
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="Console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d %-5p [%t] %C (%F:%L) - %m%n"/> </layout> </appender> <logger name="com.bmc.arsys">
<level value="fatal" /> </logger>

<!--Set root category priority to fatal --> <root> <priority value ="debug"
/> <appender-ref ref="Console" /> </root>

</log4j:configuration>
=====================

Here's my code:
When I run this code as soon as the code reaches the "server = new ARServerUser" line, I get
a lot of logs which I want disable.
===========================
import java.sql.*;
import java.io.*;
import java.util.*;
import java.lang.*;
import com.bmc.arsys.api.*;
import javax.mail.*;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;

public class checkRequest {
private static Logger logger = Logger.getLogger(checkRequest.class);

public static void main(String args[]){
String REMENV = args[0];
logger.debug("Here is some DEBUG");
if(args.length > 1) {
String requestID = args[1];
}

ARServerUser server = null;

if(REMENV.equals("TEST")) {
logger.debug("Connecting to Test remedy"); server = new ARServerUser("Demo", "r3m3dy", "",
"rearsyst01"); } server.logout();

}
}
=========================

2009-01-25 21:27:51,230 DEBUG [main] checkRequest (checkRequest.java:16)
- Here is some DEBUG
2009-01-25 21:27:51,238 DEBUG [main] checkRequest (checkRequest.java:24)
- Connecting to Test remedy
2009-01-25 21:27:51,429 DEBUG [main]
org.apache.commons.configuration.ConfigurationUtils
(ConfigurationUtils.java:515) - Configuration loade d from the context classpath (arsys_base.xml)
2009-01-25 21:27:51,537 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1249) - setDocumentLocator(com.sun.org.apache.xerce
s.internal.parsers.AbstractSAXParser$LocatorProxy@ccc588)
2009-01-25 21:27:51,540 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1283) - startDocument()
2009-01-25 21:27:51,543 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1318) -
startElement(,,configuration)
2009-01-25 21:27:51,546 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1325) - Pushing body text ''
2009-01-25 21:27:51,549 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1344) - New match='configuration'
2009-01-25 21:27:51,552 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1372) - No rules found matching 'configuration'.
2009-01-25 21:27:51,555 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1002) - characters(
)
2009-01-25 21:27:51,558 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1002) - characters(
)
2009-01-25 21:27:51,560 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1318) -
startElement(,,xml)
2009-01-25 21:27:51,562 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1325) - Pushing body text '

'
2009-01-25 21:27:51,564 DEBUG [main]
	 (Digester.java:1344) - New match='configuration/xml'
2009-01-25 21:27:51,567 DEBUG [main]
org.apache.commons.digester.Digester (Digester.java:1359) - Fire begin() for FactoryCreateRule[classN
ame=null, attributeName=null, creationFactory=org.apache.commons.configuration.ConfigurationFactory$FileConfigurationFactory@73a34b]
2009-01-25 21:27:51,579 INFO [main]
org.apache.commons.configuration.ConfigurationFactory$FileConfigurationFactory
(ConfigurationFacto

TIA
Ravi



--
Thank you,
RaVi


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message