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 Siegfried Kiermayer <si...@gmail.com> on 2011/07/13 14:16:47 UTC

Fwd: How do i configure my own log level in log4j.properties

Hi,

i followed the link
http://jaikiran.wordpress.com/2006/07/12/create-your-own-logging-level-in-log4j/
to build my own log level BENCHMARK but we use a log4.properties
instead of xml.

So it isn't working and i have no idea how to find information about
configuring my loglevel in a log4j.properties file.

log4j.appender.benchmark=org.apache.log4j.FileAppender
log4j.appender.benchmark.File=benchmark.log
log4j.appender.benchmark.layout=org.apache.log4j.PatternLayout
log4j.appender.benchmark.layout.ConversionPattern=%m%n
log4j.appender.benchmark.threshold=BENCHMARK

Is there any documentation about i missed?

Tx,

Sigi

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


AW: How do i configure my own log level in log4j.properties

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
And then I think there is a failure or missunderstanding

The log-level for a logger is set as shown in my example for all the loggers I know about,
(Chainsaw helps on that). But as I think, the word threshold is used to determin the log-level for an appender.

As you can see, the log-level for a logger can be at debug, and then this logger feeds two appenders, one logs at INFO the other at ERROR and you will not see any DEBUG statements.

It is important to understand the vertical and horizontal hierachie of loggers, appenders and filters.

Josef



-----Ursprüngliche Nachricht-----
Von: Siegfried Kiermayer [mailto:sicaine@gmail.com] 
Gesendet: Mittwoch, 13. Juli 2011 14:17
An: log4j-user@logging.apache.org
Betreff: Fwd: How do i configure my own log level in log4j.properties

Hi,

i followed the link
http://jaikiran.wordpress.com/2006/07/12/create-your-own-logging-level-in-log4j/
to build my own log level BENCHMARK but we use a log4.properties
instead of xml.

So it isn't working and i have no idea how to find information about
configuring my loglevel in a log4j.properties file.

log4j.appender.benchmark=org.apache.log4j.FileAppender
log4j.appender.benchmark.File=benchmark.log
log4j.appender.benchmark.layout=org.apache.log4j.PatternLayout
log4j.appender.benchmark.layout.ConversionPattern=%m%n
log4j.appender.benchmark.threshold=BENCHMARK

Is there any documentation about i missed?

Tx,

Sigi

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


AW: How do i configure my own log level in log4j.properties

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Mabe my example helps a bit! If not send me mail. Ask wiki, a few manuals
Available, some others to buy at book stores. Etc. and a lot info in this
Saved storewd forums e-mails. So seeking the E-mail-archive could help too.
Josef

IA64-1>ty log4j.properties
log4j.debug=false
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
log4j.rootLogger=INFO, CONSOLE, R, CHAINSAW_CLIENT, LOGFILE, CHAINSAW_AXIS2

# in absence of a true console - the log goes into
#  apache$specific:[000000]APACHE$JAKARTA_SERVER_OUTPUT.LOG

# -------------------------------------------------------------------
# CONSOLE is set to be a ConsoleAppender using a PatternLayout. -----
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p %c - %m%n

# -------------------------------------------------------------------
# R is a rolling file appender  --- not used yet / no need to parse
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.Append=true
log4j.appender.R.File=${catalina.home}logs/tomcat.log
log4j.appender.R.MaxFileSize=2MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

# -------------------------------------------------------------------
# CHAINSAW_CLIENT is an appender sending to a remote host GUI -------
#  feeding the CHAINSAW client listening on TCP/IP port 4445
log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketHubAppender
#-log4j.appender.CHAINSAW_CLIENT.RemoteHost=C038020
log4j.appender.CHAINSAW_CLIENT.Port=4449
log4j.appender.CHAINSAW_CLIENT.LocationInfo=true

# -------------------------------------------------------------------
# LOGFILE is set to be a File appender using a PatternLayout. -------
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=/axcls/axis2_SpServer.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%-5p - %m%n

#log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
#log4j.appender.LOGFILE.layout=org.apache.log4j.xml.XMLLayout

# -------------------------------------------------------------------
# CHAINSAW_AXIS2 is an appender sending to a remote host GUI -------
#  feeding the CHAINSAW client listening on TCP/IP port 4445
log4j.appender.CHAINSAW_AXIS2=org.apache.log4j.net.SocketHubAppender
log4j.appender.CHAINSAW_AXIS2.Port=4450
log4j.appender.CHAINSAW_AXIS2.LocationInfo=true

# -------------------------------------------------------------------
#- Set your loggers priority to what you need -----------------------
#     Logger logging             WHAT it logs   WHO is actually logging
log4j.logger.org.apache.catalina=INFO,          CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.coyote=INFO,            CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.jasper=INFO,            CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.jk=INFO,                CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.tomcat=INFO,            CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.commons=INFO,           CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.axiom=WARN,             CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.axis2=INFO,             CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.org.apache.axis2.deployment=DEBUG, CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.de.hunsicker.jalopy.io=FATAL,      CONSOLE, R, CHAINSAW_CLIENT
log4j.logger.httpclient.wire.header=FATAL,      CONSOLE, R, CHAINSAW_CLIENT

# -------------------------------------------------------------------
#- create the SpServer Logger ---------------------------------------
# this is the CONFIGURED logger for the SpServer.java JavaPart
# the Configurator strips of the logger_prefix "log4j.logger."
#  the logger is then known in the hierarchy as
#   "axawl.spezpla.servers.SpezplaService.SpServer"
#    retrive this configured logger from log4j.hierarchy through
#     Logger log = Logger.getLogger(SpServer.class);
log4j.logger.axawl.spezpla.servers.SpezplaService.SpServer=INFO, LOGFILE, CHAINSAW_AXIS2


# -------------------------------------------------------------------
# define the additivities used to prevent logging twice the same msg
# NOTE: each logger needs an additivity set or you risk logging twice
#
log4j.additivity.org.apache.axiom=false
log4j.additivity.org.apache.axis2=false
log4j.additivity.org.apache.axis2.deployment=false
log4j.additivity.org.apache.catalina=false
log4j.additivity.org.apache.coyote=false
log4j.additivity.org.apache.jasper=false
log4j.additivity.org.apache.jk=false
log4j.additivity.org.apache.commons=false


# to prevent that logging events are propagated to parent loggers
# and finally arrive at the root loggers appender, printed to the root-
# loggers files i.e. additivity must be set to false to prevent this.
# please goto http://logging.apache.org/log4j/1.2/manual.html and read
# the short manual or buy the full manual
log4j.additivity.axawl.spezpla.servers.SpezplaService.SpServer=false
IA64-1>




-----Ursprüngliche Nachricht-----
Von: Siegfried Kiermayer [mailto:sicaine@gmail.com] 
Gesendet: Mittwoch, 13. Juli 2011 14:17
An: log4j-user@logging.apache.org
Betreff: Fwd: How do i configure my own log level in log4j.properties

Hi,

i followed the link
http://jaikiran.wordpress.com/2006/07/12/create-your-own-logging-level-in-log4j/
to build my own log level BENCHMARK but we use a log4.properties
instead of xml.

So it isn't working and i have no idea how to find information about
configuring my loglevel in a log4j.properties file.

log4j.appender.benchmark=org.apache.log4j.FileAppender
log4j.appender.benchmark.File=benchmark.log
log4j.appender.benchmark.layout=org.apache.log4j.PatternLayout
log4j.appender.benchmark.layout.ConversionPattern=%m%n
log4j.appender.benchmark.threshold=BENCHMARK

Is there any documentation about i missed?

Tx,

Sigi

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