简体   繁体   English

我的log4j2安装程序出现问题

[英]issue with my log4j2 setup

I was using log4j2 and it was logging statements for me with no issues. 我正在使用log4j2,它正在为我记录语句,没有任何问题。 I might have made some changes (moved from info to debug and back) but its quite possibly I might have messed up the config in some other fashion. 我可能进行了一些更改(从信息移到调试,然后再返回),但很可能我可能以其他方式弄乱了配置。 I am copying my config file below (I have not moved any log4j2 and slf4j jar files from my project). 我在下面复制我的配置文件(我尚未从项目中移出任何log4j2和slf4j jar文件)。 Any thoughts? 有什么想法吗?

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug" name="TestApp" packages="">
  <Appenders>
    <RollingRandomAccessFile name="RollingRandomAccessFile" fileName="logs/test.log" immediateFlush="false" append="false"
                 filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
      <PatternLayout>
        <Pattern>%d %p %c{1.} [%t] %m %ex%n</Pattern>
      </PatternLayout>
      <Policies>
        <TimeBasedTriggeringPolicy />
        <SizeBasedTriggeringPolicy size="500 MB"/> 
      </Policies>
    </RollingRandomAccessFile>
  </Appenders>
  <Loggers>
      <AsyncLogger name="FATAL_LOGGER" level="fatal" includeLocation="true" additivity="false">  
      <AppenderRef ref="RollingRandomAccessFile"/>
    </AsyncLogger>
    <Root level="debug" includeLocation="false">
      <AppenderRef ref="RollingRandomAccessFile"/>
    </Root>
  </Loggers>
</Configuration>

I tested the config in a test project and it works without any issues. 我在一个测试项目中测试了配置,它可以正常工作。 Ensure that you do not have any locks on the file and have correct read/write privileges on the file/directory. 确保您对文件没有任何锁定,并且对文件/目录具有正确的读/写特权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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