You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 85bed93 the encoderInit()-method was moved from setOutputStream() to start(). The RollingFileAppender will not call start() once a new file is rolled. Therefore these new files won't get a header anymore.
We are using logback to create a binary file which requires a header. Due to this change, only the first file gets the header (because start() calls encoderInit()). But every other file created by RollingFileAppender is without the header.
As a hotfix it works to override the setOutputStream-method with:
public void setOutputStream(final OutputStream outputStream) {
super.setOutputStream(outputStream);
if (isStarted()) {
try {
getOutputStream().write(getEncoder().headerBytes());
} catch (final IOException e) {
addWarn("Konnte etem-Header nicht schreiben. " + e.getMessage());
}
}
}
The isStarted()-check is needed to avoid, that the header is written twice in the beginning.
The text was updated successfully, but these errors were encountered:
balrok
added a commit
to balrok/logback
that referenced
this issue
Sep 18, 2024
this fixes issue qos-ch#857
`encoderInit` will write the header once the `OutputStreamAppender` is
started. Since the outputStream is set before starting, the other
`encoderInit` inside the `start`-method is still needed.
this fixes issue qos-ch#857
`encoderInit` will write the header once the `OutputStreamAppender` is
started. Since the outputStream is set before starting, the other
`encoderInit` inside the `start`-method is still needed.
Signed-off-by: Carl Mai <[email protected]>
In 85bed93 the
encoderInit()
-method was moved fromsetOutputStream()
tostart()
. The RollingFileAppender will not callstart()
once a new file is rolled. Therefore these new files won't get a header anymore.We are using logback to create a binary file which requires a header. Due to this change, only the first file gets the header (because
start()
callsencoderInit()
). But every other file created by RollingFileAppender is without the header.As a hotfix it works to override the
setOutputStream
-method with:The
isStarted()
-check is needed to avoid, that the header is written twice in the beginning.The text was updated successfully, but these errors were encountered: