diff --git a/inventory-provisioning-core/src/main/scala/com/normation/inventory/ldap/provisioning/LdifReportLogger.scala b/inventory-provisioning-core/src/main/scala/com/normation/inventory/ldap/provisioning/Ldi
index 7b842e4..c3a1771 100644
--- a/inventory-provisioning-core/src/main/scala/com/normation/inventory/ldap/provisioning/LdifReportLogger.scala
+++ b/inventory-provisioning-core/src/main/scala/com/normation/inventory/ldap/provisioning/LdifReportLogger.scala
@@ -67,7 +67,7 @@ trait LDIFReportLogger {
object DefaultLDIFReportLogger {
import org.slf4j.LoggerFactory
- val logger = LoggerFactory.getLogger(classOf[DefaultLDIFReportLogger])
+ val logger = LoggerFactory.getLogger("trace.ldifreport.in.file")
val defaultLogDir = System.getProperty("java.io.tmpdir") +
System.getProperty("file.separator") + "LDIFLogReport"
}
@@ -103,19 +103,21 @@ class DefaultLDIFReportLogger(val LDIFLogDir:String = DefaultLDIFReportLogger.de
var writer:LDIFWriter = null
val LDIFFile = fileFromName(reportName,tag)
try {
- logger.debug("LDIF log for report processing: " + LDIFFile.getAbsolutePath)
- writer = new LDIFWriter(LDIFFile)
-
-
- if(LDIFRecords.nonEmpty) { //don't check it if logger trace is not enabled
- writer.writeLDIFRecord(LDIFRecords.head, comments.getOrElse(null))
- LDIFRecords.tail.foreach { LDIFRecord => writer.writeLDIFRecord(LDIFRecord) }
- } else {
- //write a dummy recored
- val c = comments.getOrElse("") + "(There was no record to log, a dummy modification is added in log as a placeholder)"
- writer.writeLDIFRecord(new LDIFModifyChangeRecord("cn=dummy", new Modification(REPLACE,"dummy", "dummy")), c)
- }
-
+
+ if (logger.isTraceEnabled()){
+ logger.debug("LDIF log for report processing: " + LDIFFile.getAbsolutePath)
+ writer = new LDIFWriter(LDIFFile)
+
+ val ldif = LDIFRecords
+ if(ldif.nonEmpty) { //don't check it if logger trace is not enabled
+ writer.writeLDIFRecord(ldif.head, comments.getOrElse(null))
+ ldif.tail.foreach { LDIFRecord => writer.writeLDIFRecord(LDIFRecord) }
+ } else {
+ //write a dummy recored
+ val c = comments.getOrElse("") + "(There was no record to log, a dummy modification is added in log as a placeholder)"
+ writer.writeLDIFRecord(new LDIFModifyChangeRecord("cn=dummy", new Modification(REPLACE,"dummy", "dummy")), c)
+ }
+ }
} catch {
case e:Exception => logger.error("Exception when loggin (ignored)",e)
I also add a property into logback.xml but it's ignored by git.
<logger name="trace.ldifreport.in.file" level="off" />
i link that file