Question: I have a `log4j2` logger configuration that basically write all logging of the root logger to a basic logging file. I always use `Logger.getRootLogger` here.

For some specific events I'd like to log do a different file. How could I configure such a logger in the properties file (eg give it a name that I can then reference from code)?

Answer: 
You can do something like this.

```
    log4j.appender.transaction=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.transaction.DatePattern='.'yyyy-MM-dd
    log4j.appender.transaction.File=logs/transaction.log
    log4j.appender.transaction.layout=org.apache.log4j.PatternLayout
    log4j.appender.transaction.layout.ConversionPattern=%d{dd MMM yyyy HH\:mm\:ss} %-5p %c{2}\:%L - %m%n
    log4j.appender.transaction.threshold=info

    log4j.logger.transaction=INFO, transaction

```
I finally found out that `Marker`s are the way to route messages:

[What is markers in Java Logging frameworks and that is a reason to use them?](https://stackoverflow.com/questions/16813032/what-is-markers-in-java-logging-frameworks-and-that-is-a-reason-to-use-them)