Try copying James' example verbatim.  You missed something.

Jake

Quoting Jeremy Whitlock <[EMAIL PROTECTED]>:

> James,
> Here is my log4j.conf:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "
> http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd";>
> <log4j:configuration>
> <appender name="console" class="org.apache.log4j.ConsoleAppender">
> <layout class="org.apache.log4j.SimpleLayout" />
> </appender>
>
> <appender name="perpetuum" class="org.apache.log4j.FileAppender">
> <param name="File" value="${perpetuum.home}/logs/perpetuum.log" />
> <layout class="org.apache.log4j.SimpleLayout" />
> </appender>
>
> <appender name="jnp" class="org.apache.log4j.FileAppender">
> <param name="File" value="${perpetuum.home}/logs/jnp.log" />
> <layout class="org.apache.log4j.SimpleLayout" />
> </appender>
>
> <logger name="org.jnp" additivity="false">
> <appender-ref ref="jnp"/>
> </logger>
>
> <root>
> <priority value="debug" />
> <appender-ref ref="console" />
> <appender-ref ref="perpetuum" />
> <appender-ref ref="jnp" />
> </root>
> </log4j:configuration>
>
> Now I'm getting log messages in jnp.log but it's all levels and all
> messages, even if not from an org.jnp class. Did I implement your advice
> wrong?
>
> Take care,
> Jeremy
>
> On 10/31/05, James Stauffer <[EMAIL PROTECTED]> wrote:
> >
> > Do something like the following in your log4j.xml:
> >
> > <logger name="org.jnp" additivity="false">
> > <level value="info"/>
> > <appender-ref ref="JNPAppender"/>
> > </logger>
> >
> > That will send JNP logs to its own appender and restrict them from
> > getting to other appenders. I do the same thing for springframework.
> >
> > On 10/31/05, Jeremy Whitlock <[EMAIL PROTECTED]> wrote:
> > > James,
> > > I do not have access to the JNP source, as I'm using it only as a
> > > dependency, so I don't know if your suggestion is possible. Can you
> > assist
> > > me?
> > >
> > > Take care,
> > > Jeremy
> > >
> > > On 10/31/05, Jeremy Whitlock <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hey all,
> > > > I'm impressed with the quickness of your responses. I do not have
> > access
> > > > to 1.3 yet since it's not final so I'll need something else. Here is
> > what
> > > > I'm trying to do:
> > > >
> > > > I'm embedding JNP from JBoss in my app. In doing so, JNP uses log4j
> > for
> > > > it's own logging. I want all JNP related log messages to go into
> > jnp.logwhile the rest of the log messages go into
> > > > perpetuum.log. All messages should go into the console.
> > > >
> > > > Does this make sense? If so, can you assist me? I've read a lot of the
> > > > examples online and in the javadoc but I don't see this being done,
> > atleast
> > > > not the class stuff. I'll try the applicable suggestion from James.
> > > >
> > > > Take care,
> > > > Jeremy
> > > >
> > > > On 10/31/05, Scott Deboy <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > If you can use log4j 1.3, you could use an ExpressionFilter, with
> > the
> > > > > expression:
> > > > >
> > > > > CLASS ~= 'javax.naming' || CLASS ~= 'org.jnp.server'
> > > > >
> > > > > With acceptonmatch to false
> > > > >
> > > > > See JavaDoc for more info on the filter.
> > > > >
> > > > >
> > http://svn.apache.org/viewcvs.cgi/logging/log4j/trunk/src/java/org/apach
> > > > > e/log4j/filter/ExpressionFilter.java?view=markup
> > > > >
> > > > > Some of the keywords you can use are:
> > > > > MSG, LOGGER, LEVEL, CLASS, FILE, LINE, METHOD, NDC, AND
> PROP.AAAA(which
> > > > > allows you to filter on mdc with key AAAA)
> > > > >
> > > > > Chainsaw describes this stuff in detail in the tutorial.
> > > > >
> > > > > Scott
> > > > >
> > > > > -----Original Message-----
> > > > > From: Jeremy Whitlock [mailto:[EMAIL PROTECTED]
> > > > > Sent: Monday, October 31, 2005 1:01 PM
> > > > > To: Log4J-User
> > > > > Subject: Filter Based On Logging Class
> > > > >
> > > > > Hey all,
> > > > > I would like to implement a filter that would allow me to restrict
> > > > > messages based on the class that is sending the LoggingEvent. So I
> > could
> > > > > have something like:
> > > > >
> > > > > <filter class="my.filter.Class ">
> > > > > <param name="acceptOnMatch" value="false" /> <param
> > name="expression"
> > > > > value="javax.naming org.jnp.server" /> </filter>
> > > > >
> > > > > And the filter would not log any class that created a LoggingEvent
> > if
> > > > > that class was in either of those packages. Is there one of these
> > > > > available? If not, how should I go about writing one? I do not see
> > how I
> > > > > can get the class from the LoggingEvent.
> > > > >
> > > > > Take care,
> > > > > Jeremy
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > >
> > >
> >
> >
> > --
> > James Stauffer
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > 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]

Reply via email to