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 rakesh patel <rp...@us.nomura.com> on 2005/12/28 21:58:02 UTC

RootLogger and Appenders and performance

The following is my log4j.properties file. It basically logs to a 
RollingFileAppender and to a SocketHubAppender. I have the following issues, 
maybe some of the experts can clarify.

1. Is it true that the A3 appender will actually "see" INFO messages and will 
be evaluated by the A3 before they are discarded by the SocketHubAppender due 
to the threshold set to WARN and rootLogger=INFO? If so, how do I get the A3 to 
only see the WARN (and above) level messages?I still want the A1 appender to 
log INFO though.

2. It it true that introducing the ConversionPattern in the SocketHubAppender 
introduces a processing delay? If so, is there anything I can do to maximize 
the performance of the SocketHubAppender?

3. People in my team are saying the fact I have a SocketHubAppender introduces 
an inherit performance hit with is not seen when we are only logging to the 
RollingFileAppender? Can this be true?

Thanks
Rakesh



--

log4j.rootLogger=INFO,A1,A3

# *****************************************************************
# Appender A1 - Rolling File
# *****************************************************************

log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=log/mylog.log

# Set the layout for the Appender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d %-5p - %m%n


# *****************************************************************
# Appender A3 - Socket 
# *****************************************************************

# Define the actual Appender to use that is associated with our string; in this
# case we select the SocketHubAppender which writes to a file
log4j.appender.A3=org.apache.log4j.net.SocketHubAppender
log4j.appender.A3.Threshold=WARN
log4j.appender.A3.Port=15004
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=%d %-5p %c - %m%n


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


Re: RootLogger and Appenders and performance

Posted by James Stauffer <st...@gmail.com>.
1.  Yes.  Unless you know that is a problem, I wouldn't worry about
it.  The only way around that is if you can set the root logger to
WARN, A3 and a deeper logger set to INFO, A1 (assuming that works for
you).

2. I thought the Socket appender serialized the LoggingEvent object so
a layout wouln't make sense (but I haven't used it).

3. If you don't know that it is a problem for your application than
don't worry about it.  Generally don't worry about potential
performance problems -- do measurements to find any actual performance
problems.

On 12/28/05, rakesh patel <rp...@us.nomura.com> wrote:
> The following is my log4j.properties file. It basically logs to a
> RollingFileAppender and to a SocketHubAppender. I have the following issues,
> maybe some of the experts can clarify.
>
> 1. Is it true that the A3 appender will actually "see" INFO messages and will
> be evaluated by the A3 before they are discarded by the SocketHubAppender due
> to the threshold set to WARN and rootLogger=INFO? If so, how do I get the A3 to
> only see the WARN (and above) level messages?I still want the A1 appender to
> log INFO though.
>
> 2. It it true that introducing the ConversionPattern in the SocketHubAppender
> introduces a processing delay? If so, is there anything I can do to maximize
> the performance of the SocketHubAppender?
>
> 3. People in my team are saying the fact I have a SocketHubAppender introduces
> an inherit performance hit with is not seen when we are only logging to the
> RollingFileAppender? Can this be true?
>
> Thanks
> Rakesh
>
>
>
> --
>
> log4j.rootLogger=INFO,A1,A3
>
> # *****************************************************************
> # Appender A1 - Rolling File
> # *****************************************************************
>
> log4j.appender.A1=org.apache.log4j.RollingFileAppender
> log4j.appender.A1.File=log/mylog.log
>
> # Set the layout for the Appender
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%d %-5p - %m%n
>
>
> # *****************************************************************
> # Appender A3 - Socket
> # *****************************************************************
>
> # Define the actual Appender to use that is associated with our string; in this
> # case we select the SocketHubAppender which writes to a file
> log4j.appender.A3=org.apache.log4j.net.SocketHubAppender
> log4j.appender.A3.Threshold=WARN
> log4j.appender.A3.Port=15004
> log4j.appender.A3.layout=org.apache.log4j.PatternLayout
> log4j.appender.A3.layout.ConversionPattern=%d %-5p %c - %m%n
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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