Mule Log4j2配置 ${MULE_HOME}/logs/sfdc [%-5level]%d{yyyy-MM-dd HH:MM:ss.SSS}[%t]%c{1}-%msg%n [%-5level]%d{yyyy-MM-dd HH:MM:ss.SSS}[%t]%c{1}-%msg%n [%-5level]%d{yyyy-MM-dd HH:MM:ss.SSS}[%t]%c{1}-%msg%n
在mule-app.properties中指定mule\u HOME=C:/sfproject/test 我面临的问题是,它没有从MULE-app.properties获取路径${MULE\u HOME}location,但它会在项目的HOME location(MULE\u HOME=C:/sfproject/)下创建一个目录,作为${MULE\u HOME}/在我的本地目录中的日志。我希望所有日志文件都应该放在C:/sfproject/test/logs目录下 当我在服务器中部署相同的日志时(在mule-app.properties中注释了mule_home path,因为它不是必需的,并且应该指向服务器位置,然后指向日志目录),在servers/logs目录下不会创建日志文件 编辑:Mule Log4j2配置 ${MULE_HOME}/logs/sfdc [%-5level]%d{yyyy-MM-dd HH:MM:ss.SSS}[%t]%c{1}-%msg%n [%-5level]%d{yyyy-MM-dd HH:MM:ss.SSS}[%t]%c{1}-%msg%n [%-5level]%d{yyyy-MM-dd HH:MM:ss.SSS}[%t]%c{1}-%msg%n,mule,log4j2,Mule,Log4j2,在mule-app.properties中指定mule\u HOME=C:/sfproject/test 我面临的问题是,它没有从MULE-app.properties获取路径${MULE\u HOME}location,但它会在项目的HOME location(MULE\u HOME=C:/sfproject/)下创建一个目录,作为${MULE\u HOME}/在我的本地目录中的日志。我希望所有日志文件都应该放在C:/sfproject/test/logs目录下 当我在服务器中部署相同的日志时
根据下面给出的Ryan答案,要在anypoint studio中本地工作,请右键单击project->Run as->Run configuration->ENVIRONMENT->New->Name(MULE_HOME)->Value(c:/project/test)->ok->apply->Run。尝试使用
env
前缀查找环境变量:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="log-path">${MULE_HOME}/logs/sfdc</Property>
</Properties>
<Appenders>
<Console name="console-log" target="SYSTEM_OUT">
<PatternLayout
pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" />
</Console>
<RollingFile name="info-log" fileName="${log-path}/sfdc-info.log"
filePattern="${log-path}/sfdc-info-%d{yyyy-MM-dd}.log">
<PatternLayout>
<pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
</Policies>
</RollingFile>
<RollingFile name="trace-log" fileName="${log-path}/sfdc-trace.log"
filePattern="${log-path}/sfdc-trace-%d{yyyy-MM-dd}.log">
<PatternLayout>
<pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
</Policies>
</RollingFile>
<RollingFile name="error-log" fileName="${log-path}/sfdc-error.log"
filePattern="${log-path}/sfdc-error-%d{yyyy-MM-dd}.log">
<PatternLayout>
<pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<AsyncLogger name="org.apache" level="WARN"/>
<AsyncLogger name="org.springframework.beans.factory" level="WARN"/>
<AsyncLogger name="org.mule" level="INFO"/>
<AsyncLogger name="com.mulesoft" level="INFO"/>
<Logger name="com.test" level="info" additivity="false">
<appender-ref ref="info-log" level="info" />
<appender-ref ref="trace-log" level="debug" />
<appender-ref ref="error-log" level="error" />
<appender-ref ref="console-log" level="debug" />
</Logger>
<Root level="info" additivity="false">
<AppenderRef ref="info-log" />
</Root>
</Loggers>
</Configuration>
此log4j2.xml配置是否正确?如果我给出,它不会显示在日志中
${env:MULE_HOME}