简体   繁体   中英

How to inherit log4j configuration xml?

I have a log4j2.xml that performs basic webservice logging. As I want to include the webservice project as dependency within another project, I'd like to inherit the logging configuration.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <RollingFile name="rolling">
            ...
        </RollingFile>
    </Appenders>

    <Loggers>
        <Root level="all">
            <AppenderRef ref="rolling />
        </Root>
    </Loggers>
</Configuration>

As I did not find a way so far to inherit this config. Is it impossible?

I don't know exactly what you mean by inheriting a logging configuration, but log4j2 supports XInclude for XML configurations. I hope that is useful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM