You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by David Durham <da...@gmail.com> on 2005/10/13 15:06:04 UTC

log4j xml configuration problem -- should be easy

I've tried using the following config with log4j-1.2.12.jar and
commons-logging 1.0.4 and commons-logging 1.0.5.  The only logger that
I can get anything out of is the root logger.  Configuration below,
usage will follow:  (Also, apologies for the formatting; eclipse still
does not have tab replacement, that I know of, for the text-editor)

<?xml version="1.0" encoding="UTF-8" ?>

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

	<root>
	   <level value="debug"/>
	   <appender-ref ref="rollingFile"/>
	</root>

	<logger name="com">
		<level value="debug"/>
		<appender-ref ref="rollingFile"/>
	</logger>

	<logger name="org">
		<level value="debug"/>
		<appender-ref ref="rollingFile"/>
	</logger>

    <appender name="rollingFile"
              class="org.apache.log4j.RollingFileAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{dd MMM yyyy
                        HH:mm:ss} %c %m%n"/>
        </layout>
	<param name="maxFileSize" value="100KB"/>
        <param name="file" value="/home/ddurham/meijer-store-dir.log"/>
    </appender>

</log4j:configuration>



JSP test usage:


<%@ page import="org.apache.commons.logging.*" %>
<%
Log root = LogFactory.getLog("root");
root.debug("root");

Log org = LogFactory.getLog("org");
org.debug("org");

Log com = LogFactory.getLog("com");
com.debug("com");
%>

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