You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2008/05/05 16:23:28 UTC
DO NOT REPLY [Bug 44932] New: improve DailyRollingFileAppender
handling of rotation errors
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
Summary: improve DailyRollingFileAppender handling of rotation
errors
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: enhancement
Priority: P2
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: hmak@vaultus.com
Request to improve DailyRollingFileAppender handling of errors during log
rotation. If an error occur,
P1. Old logs [to archive] can be lost. Can occur if
scheduled-file=name [to archive to] cannot be deleted during rotation
P2. It can end up infinite looping if ErrorHandler itself uses
DailyRollingFileAppender
To address above issues, I'm currently use customized version of
DailyRollingFileAppender with the following changes:
C1. If cannot delete scheduled-file-name, then continue appending
to existing file (i.e., don't rotate)
C2. Defer invocating ErrorHandler until very end of rollOver()
method.
i.e., Change Log4j v1.2.15 from
void rollOver() throws IOException {
...
if (target.exists()) {
target.delete();
}
File file = new File(fileName);
boolean result = file.renameTo(target);
if(result) {
LogLog.debug(fileName +" -> "+ scheduledFilename);
} else {
LogLog.error("Failed to rename ["+fileName+"] to
["+scheduledFilename+"].");
}
try {
// This will also close the file. This is OK since
multiple
// close operations are safe.
this.setFile(fileName, false, this.bufferedIO,
this.bufferSize);
}
catch(IOException e) {
errorHandler.error("setFile("+fileName+", false) call
failed.");
}
...
}
to
void rollOver() throws IOException {
...
List<String> errMsgs = new LinkedList<String>();
boolean result = true;
if (target.exists()) {
result = target.delete();
}
if (! result) {
errMsgs.add("Failed to delete [" + scheduledFilename +
"]. Log file will not be rolled over!");
} else {
File file = new File(fileName);
result = file.renameTo(target);
if(result) {
LogLog.debug(fileName +" -> "+
scheduledFilename);
} else {
errMsgs.add("Failed to rename ["+fileName+"] to
["+scheduledFilename+"]. Log file will not be rolled over!");
}
}
try {
this.setFile(
fileName,
// Append if rollover [to schedule
file] failed, else overwrite
! result,
this.bufferedIO,
this.bufferSize);
// Finally write out error messages now that Log4j is
closer to being stable
for (String msg : errMsgs) {
errorHandler.error(msg);
}
}
catch(IOException e) {
errorHandler.error("setFile("+fileName+", false) call
failed.");
}
...
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
Daniel Serodio <as...@neverbox.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |asfbugzilla.e.dserodio@neve
| |rbox.com
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
--- Comment #4 from bouliz@hotmail.com 2010-11-12 15:57:21 EST ---
Does log4g 1.2.16 solve this issue ?
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[Bug 44932] improve DailyRollingFileAppender handling of rotation
errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
--- Comment #6 from gyadav@apple.com ---
And if there exists any workaround to resolve this issue, then also please let
me know.
Thanks
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
[Bug 44932] improve DailyRollingFileAppender handling of rotation
errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
--- Comment #5 from gyadav@apple.com ---
Is this issue resolved in any of the log4j version? Please let me know.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
Anton Khitrenovich <kh...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |khitrenovich@gmail.com
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
apache@kastl-nbg.de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |apache@kastl-nbg.de
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
Thorbjørn Ravn Andersen <th...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |45527
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
apache@kastl-nbg.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |critical
--- Comment #3 from apache@kastl-nbg.de 2009-07-01 01:38:52 PST ---
I lost a log file for a whole day due to issue P1, so I would say this is a
critical Bug not only an enhancement.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
Curt Arnold <ca...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks|45527 |
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
Andy Shen <an...@shenie.info> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andy@shenie.info
--- Comment #2 from Andy Shen <an...@shenie.info> 2008-07-02 18:52:25 PST ---
Can we apply the same logic to RollingFileAppender as well?
Cheers,
Andy
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 44932] improve DailyRollingFileAppender handling
of rotation errors
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44932
johan.guiheneuf@sgcib.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |johan.guiheneuf@sgcib.com
--- Comment #1 from johan.guiheneuf@sgcib.com 2008-06-02 01:25:33 PST ---
Case P1 viewed on a computer with 4 procesors.
The same software is ran on the 4 processors. If one of the processors is
running the software à 12PM, then all the log of the day is lost.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org