You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Paul Cooper (Jira)" <ji...@apache.org> on 2022/01/10 18:21:00 UTC

[jira] [Updated] (LOG4J2-3328) Log4j bridge does not support system properties in log4j.xml

     [ https://issues.apache.org/jira/browse/LOG4J2-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Cooper updated LOG4J2-3328:
--------------------------------
    Component/s: Log4j 1.2 bridge
                     (was: Configuration)

> Log4j bridge does not support system properties in log4j.xml
> ------------------------------------------------------------
>
>                 Key: LOG4J2-3328
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3328
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Log4j 1.2 bridge
>    Affects Versions: 2.17.1
>         Environment: {{Windows 10}}
> {{Amazon Linux}}
>            Reporter: Paul Cooper
>            Priority: Blocker
>
> I am attempting to use the log4j bridge with log4j2, and cannot use system properties to set a location for my log files.
> Reported here: [stackoverflow|https://stackoverflow.com/questions/70628593/system-property-not-being-read-by-log4j2-lo4j1-bridge]
> My log4j.xml file:
> {{log4j-dev.xml}}
> {{...}}
> {{<appender name="DAILY" class="org.apache.log4j.RollingFileAppender">}}
> {{<param name="File" value="${catalina.base}/logs/etl.log"/>}}
> {{<param name="DatePattern" value="'.'yyyy-MM-dd"/>}}
> {{<layout class="org.apache.log4j.PatternLayout">}}
> {{<param name="ConversionPattern" value="GATEWAY: %p %d [%t] %c\{1}.%M(%L) | %m%n"/>}}
> {{</layout>}}
> {{</appender>}}
> {{...}}
> The setenv.bat entry where I define which log4j.xml to use:
> {{-Dlog4j2.debug=true -Dlog4j.configuration=log4j-dev.xml}}
> The properties shown in the tomcat log illustrating that the system property in question is being supplied to the log4j1 bridge
> {{...}}
> {{Command line argument: -Dlog4j2.debug=true}}
> {{Command line argument: -Dlog4j.logDir=C:\dev\apache-tomcat-8.5.50\logs}}
> {{Command line argument: -Dlog4j.configuration=log4j-dev.xml}}
> {{Command line argument: -Dcatalina.base=C:\dev\apache-tomcat-8.5.50}}
> {{Command line argument: -Dcatalina.home=C:\dev\apache-tomcat-8.5.50}}
> {{Command line argument: -Djava.io.tmpdir=C:\dev\apache-tomcat-8.5.50\temp}}
> {{...}}
> And the part of the log that shows where the log file is successfully created and what path it is using:
> {{...}}
> {{DEBUG StatusLogger Class name: [org.apache.log4j.RollingFileAppender]}}
> {{DEBUG StatusLogger Parsing layout of class: "org.apache.log4j.PatternLayout"}}
> {{DEBUG StatusLogger PluginManager 'Converter' found 47 plugins}}
> {{TRACE StatusLogger New file '${catalina.base}/etl.log' created = true}}
> {{DEBUG StatusLogger Returning file creation time for C:\dev\apache-tomcat-8.5.50\bin\${catalina.base}\etl.log}}
> {{DEBUG StatusLogger Starting RollingFileManager ${catalina.base}/etl.log}}
> {{...}}
> The log file is being created in a folder named "${catalina.base}", in whatever directory I'm in when I start tomcat.  The issue is similar to this Jira issue, LOG4J2-2951, and that issue was just resolved in early December.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)