* Logs: Fix setting log filename (ticket #805)

This commit is contained in:
zzz
2013-01-02 14:12:02 +00:00
parent 71607fff2d
commit 6f301f01dc
2 changed files with 13 additions and 7 deletions

View File

@ -347,13 +347,18 @@ public class LogManager {
_displayOnScreen = false;
}
// prior to 0.9.5, override prop trumped config file
// as of 0.9.5, override prop trumps config file only if config file is set to default,
// so it may be set in the UI.
String filename = config.getProperty(PROP_FILENAME, DEFAULT_FILENAME);
String filenameOverride = _context.getProperty(FILENAME_OVERRIDE_PROP);
if (filenameOverride != null)
if (filenameOverride != null && !filename.equals(DEFAULT_FILENAME))
setBaseLogfilename(filenameOverride);
else
setBaseLogfilename(config.getProperty(PROP_FILENAME, DEFAULT_FILENAME));
setBaseLogfilename(filename);
_fileSize = getFileSize(config.getProperty(PROP_FILESIZE, DEFAULT_FILESIZE));
_rotationLimit = -1;
try {
_rotationLimit = Integer.parseInt(config.getProperty(PROP_ROTATIONLIMIT, DEFAULT_ROTATIONLIMIT));
@ -620,11 +625,11 @@ public class LogManager {
rv.setProperty(PROP_FORMAT, new String(_format));
rv.setProperty(PROP_DATEFORMAT, _dateFormatPattern);
rv.setProperty(PROP_DISPLAYONSCREEN, Boolean.toString(_displayOnScreen));
String filenameOverride = _context.getProperty(FILENAME_OVERRIDE_PROP);
if (filenameOverride == null)
rv.setProperty(PROP_FILENAME, _baseLogfilename);
else // this isn't technically correct - this could mess with some funky scenarios
rv.setProperty(PROP_FILENAME, DEFAULT_FILENAME);
// prior to 0.9.5, override prop trumped config file
// as of 0.9.5, override prop trumps config file only if config file is set to default,
// so it may be set in the UI.
rv.setProperty(PROP_FILENAME, _baseLogfilename);
if (_fileSize >= 1024*1024)
rv.setProperty(PROP_FILESIZE, (_fileSize / (1024*1024)) + "m");

View File

@ -8,6 +8,7 @@
- Remove static logs
- Fix leak if nonce = 0 but reliability != none
- More work on failure codes (ticket #788)
* Logs: Fix setting log filename (ticket #805)
* SAM: Synchronize dissector
* Transport: Fix early NPE (ticket #824)