Search code examples
log4j

How are logger names defined in Log4j v1 properties configuration?


I'm attempting to convert Log4j v1 properties configuration into some form of Log4j v2 config, but the problem is that I don't know what I'm reading when I look at the v1 properties file. Very little documentation is available for Log4j v1 configuration. In particular, I've managed to infer over six months of work that standard (non-Root) loggers must have defined names. These names appear to be defined implicitly, but the documentation is utterly worthless, and I can't find any clear statement from the developers about how that implicit process works.

Of the following examples I've been able to pull from the Internet, which lines define the names of individual loggers, and which define other properties? Of the lines that define names, what are those names?

log4j.logger.org.apache.axis.utils=ERROR
log4j.logger.strike=DEBUG
log4j.logger.strike.textfiles=DEBUG
log4j.logger.org.krake.strike.trace=INFO
log4j.logger.org.medusa.orm.armadillo.Loader=DEBUG
log4j.logger.org.medusa.orm.armadillo.functions.ProcessBulkErrors=WARN
log4j.logger.org.medusa.orm.engine.Armadillo=INFO
log4j.logger.org.medusa.orm.armadillo.lib=INFO
log4j.logger.org.medusa.orm.armadillo.ORM2ExecutionContext=DEBUG
log4j.logger.org.medusa.orm.armadillo.lib.GetFieldValue=DEBUG
log4j.logger.org.medusa.orm.toolkit.ORMt2ORMx=DEBUG
log4j.logger.org.krake.box.abstraction.slidr.service.job.manager.Cpu=DEBUG
log4j.logger.org.krake.box.abstraction.slidr.service.job.manager.Block=DEBUG
log4j.logger.org.krake.box.abstraction.slidr.service.job.manager.SimpleCloudWorkerManager=INFO
log4j.logger.org.krake.box.abstraction.impl.scheduler.common.AbstractExecutor=DEBUG
log4j.logger.org.krake.box.abstraction.impl.scheduler.pbs.PBSExecutor=DEBUG
log4j.logger.org.krake.box.armadillo.workflow.events.WorkerSweeper=WARN
log4j.logger.org.krake.box.armadillo.workflow.nodes.FlowNode=WARN
log4j.logger.org.krake.box.armadillo.scheduler.WeightedHostScoreScheduler=INFO
log4j.logger.org.krake.box.abstraction.impl.common.task.TaskImpl=INFO
log4j.logger.org.krake.box.abstraction.slidr.rlog=INFO
log4j.logger.com.senatus.impl.execution.ec2=DEBUG
log4j.logger.com.endeca=INFO
log4j.logger.com.endeca.itl.web.metrics=INFO

In short, what is the actual algorithm for defining logger names in Log4j v1's properties-based configuration?


Solution

  • In older software like Log4j 1.2 the best documentation is the javadoc. In the PropertyConfigurator javadoc you can find out that all properties of the form:

    log4j.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
    

    configure loggers and the logger name is the part of the key after the log4j.logger. prefix.

    Other logger configuration options are only described in the source code. For example to configure the logger additivity you need to use this form:

    log4j.additivity.logger_name=[true|false]