Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RollingFile Appender creates .tmp files #724

Open
pshivaji-tibco opened this issue Nov 1, 2023 · 0 comments
Open

RollingFile Appender creates .tmp files #724

pshivaji-tibco opened this issue Nov 1, 2023 · 0 comments

Comments

@pshivaji-tibco
Copy link

pshivaji-tibco commented Nov 1, 2023

When file compression is enabled and triggered (gz or zip) and the program exits before Logback can complete the compression, the .tmp files created.

Logback file:

<configuration scan="true">
<shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>
  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${BW_LOG_DIR}/test.log</file>
    <!-- <fileNamePattern>${BW_LOG_DIR}/test.log</fileNamePattern> -->
    <append>true</append>
    <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${BW_LOG_DIR}/test.log.%d{yyyy-MM-dd}.log%i.zip</fileNamePattern>
<!-- each file should be at most 100MB, keep 60 days' worth of history, but at most 1GB -->
<maxFileSize>1KB</maxFileSize>
<maxHistory>0</maxHistory>
<totalSizeCap>1KB</totalSizeCap>
 </rollingPolicy>
 <encoder>
      <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] &lt;%X{operationID}&gt; %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

I tried of using shutdownhook as you can see in the above snippet but still .tmp files are generated. I am using logback-core version 1.2.10.
Please help me out with the above issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant