summaryrefslogtreecommitdiffstats
path: root/misc/log4j/src/main/java/org
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-06-11 19:40:45 -0500
committerInstrumental <jonathan.gathman@att.com>2019-06-11 19:41:00 -0500
commita77e3d6e9180c1722a9d18f7717034bb0650a130 (patch)
tree9080419dd0f7644273546c2c41727d047e95908f /misc/log4j/src/main/java/org
parent355b886d817295d2bca5af28f01576bf4a3ded18 (diff)
Update for more Logging Info
Issue-ID: AAF-853 Change-Id: I51e9160e2b53ebf74ba5f93c9a634a790f7ed848 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc/log4j/src/main/java/org')
-rw-r--r--misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java b/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
index 9a615fb8..85aae6f0 100644
--- a/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
+++ b/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
@@ -57,14 +57,20 @@ public class LogFileNamer {
*/
public String setAppender(String appender) throws IOException {
File f = new File(String.format(FIRST_FILE_FORMAT_STR, dir, root, appender));
+ File lock = new File(f.getAbsoluteFile()+".lock");
if(f.exists()) {
- int i = 0;
- while ((f = new File(String.format(FILE_FORMAT_STR, dir, root, appender, i))).exists()) {
- ++i;
- }
+ if(lock.exists()) {
+ int i = 0;
+ while ((f = new File(String.format(FILE_FORMAT_STR, dir, root, appender, i))).exists() &&
+ (lock = new File(f.getAbsoluteFile()+".lock")).exists()) {
+ ++i;
+ }
+ }
}
try {
+ lock.createNewFile();
+ lock.deleteOnExit();
f.createNewFile();
} catch (IOException e) {
throw new IOException("Cannot create file '" + f.getCanonicalPath() + '\'', e);