diff options
author | Daniel Trebbien <dtrebbien@gmail.com> | 2017-07-30 13:26:05 -0700 |
---|---|---|
committer | Daniel Trebbien <dtrebbien@gmail.com> | 2017-07-30 13:26:05 -0700 |
commit | 0b15664f1c667c6bab69d44ffa6f5cf966ae38cf (patch) | |
tree | 77d5449f9d5d35d44f1f43524e0db18c2e511924 /archiva-modules/archiva-base/archiva-filelock | |
parent | f637c02c714952a88b999d00ecf78bb18975d0d1 (diff) | |
download | archiva-0b15664f1c667c6bab69d44ffa6f5cf966ae38cf.tar.gz archiva-0b15664f1c667c6bab69d44ffa6f5cf966ae38cf.zip |
Utilize parameterized logging and remove toString() calls
As suggested in the SLF4J FAQ:
https://www.slf4j.org/faq.html#logging_performance
.. parameterized logging can improve the efficiency of logger calls when
logging at the specified level is disabled.
In addition, per the FAQ: https://www.slf4j.org/faq.html#paramException
since SLF4J 1.6.0 it is possible to use parameterized logging and also
log an exception/throwable.
toString() is called automatically:
https://www.slf4j.org/faq.html#string_contents
These changes were suggested by SLF4J Helper for NetBeans IDE:
http://plugins.netbeans.org/plugin/72557/
Diffstat (limited to 'archiva-modules/archiva-base/archiva-filelock')
2 files changed, 12 insertions, 12 deletions
diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java index af189ba49..adcdbc7a8 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTest.java @@ -112,7 +112,7 @@ public class DefaultFileLockManagerTest { logger.info("thread1 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -132,7 +132,7 @@ public class DefaultFileLockManagerTest { logger.info("thread2 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -156,7 +156,7 @@ public class DefaultFileLockManagerTest { logger.info("thread3 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -177,7 +177,7 @@ public class DefaultFileLockManagerTest { logger.info("thread4 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -198,7 +198,7 @@ public class DefaultFileLockManagerTest { logger.info("thread5 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -221,7 +221,7 @@ public class DefaultFileLockManagerTest { logger.info("thread6 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -242,7 +242,7 @@ public class DefaultFileLockManagerTest { logger.info("thread7 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -265,7 +265,7 @@ public class DefaultFileLockManagerTest { logger.info("thread8 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -286,7 +286,7 @@ public class DefaultFileLockManagerTest { logger.info("thread9 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } @@ -308,7 +308,7 @@ public class DefaultFileLockManagerTest { logger.info("thread10 ok"); success.incrementAndGet(); } catch (Throwable e) { - logger.error("Error occured " + e.getMessage()); + logger.error("Error occured {}", e.getMessage()); e.printStackTrace(); throw e; } diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java index 666efee18..514dfde02 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/java/org/apache/archiva/common/filelock/DefaultFileLockManagerTimeoutTest.java @@ -76,14 +76,14 @@ public class DefaultFileLockManagerTimeoutTest try { Files.copy(largeJar.toPath(), lock.getFile().toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { - logger.warn("Copy failed "+e.getMessage()); + logger.warn("Copy failed {}", e.getMessage()); // On windows a FileSystemException is thrown // We ignore this } lock = fileLockManager.writeFileLock(file); } catch (FileSystemException ex) { - logger.error("Exception from filesystem "+ex.getMessage()); + logger.error("Exception from filesystem {}", ex.getMessage()); ex.printStackTrace(); throw ex; } |