[logback-dev] [JIRA] Updates for LOGBACK-1543: prudent mode lose efficacy since v1.2.0
QOS.CH (JIRA)
noreply-jira at qos.ch
Mon Nov 30 04:50:00 CET 2020
logback / LOGBACK-1543 [Open]
prudent mode lose efficacy since v1.2.0
==============================
Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.
View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1543
==============================
Issue created
------------------------------
nico_wen created this issue on 30/Nov/20 4:39 AM
Summary: prudent mode lose efficacy since v1.2.0
Issue Type: Bug
Affects Versions: 1.2.0
Assignee: Logback dev list
Components: logback-core
Created: 30/Nov/20 4:39 AM
Environment:
Since v1.2.0 the prudent mode is almost useless because safeWrite never get really invoked
before v1.2.0
{code:java}
// OutputStreamAppender.java
try {
// skip some irrelevant codes...
writeOut(event)
} catch (IOException ioe) {
this.started = false;
addStatus(new ErrorStatus("IO failure in appender", this, ioe));
}
// and writeOut is overrided by FileAppender.java
@Override
protected void writeOut(E event) throws IOException {
if (prudent) {
safeWrite(event); // here is the point, it ensure write integrity with file lock
} else {
super.writeOut(event);
}
}{code}
but since v1.2.0, the code was refactored to this
{code:java}
// OutputStreamAppender.java
protected void subAppend(E event) {
if (!isStarted()) {
return;
}
try {
// skip some irrelevant codes...
byte[] byteArray = this.encoder.encode(event);
writeBytes(byteArray); // there is no guarantee to safe write
} catch (IOException ioe) {
this.started = false;
addStatus(new ErrorStatus("IO failure in appender", this, ioe));
}
}
{code}
Priority: Critical
Reporter: nico_wen
==============================
This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)
More information about the logback-dev
mailing list