You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2014/10/31 09:16:18 UTC
git commit: Avoid grabing the context if we have not set the logger
to trace in any level
Repository: directory-fortress-core
Updated Branches:
refs/heads/master 0ed35ee7f -> 3f2cbc5df
Avoid grabing the context if we have not set the logger to trace in any
level
Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/3f2cbc5d
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/3f2cbc5d
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/3f2cbc5d
Branch: refs/heads/master
Commit: 3f2cbc5dfe527d586d65ecb66f93c21d3f9e4771
Parents: 0ed35ee
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 31 09:15:28 2014 +0100
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 31 09:15:28 2014 +0100
----------------------------------------------------------------------
.../directory/fortress/core/util/LogUtil.java | 47 +++++++++++---------
1 file changed, 27 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/3f2cbc5d/src/main/java/org/apache/directory/fortress/core/util/LogUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/LogUtil.java b/src/main/java/org/apache/directory/fortress/core/util/LogUtil.java
index 402663a..59e8164 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/LogUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/LogUtil.java
@@ -19,6 +19,7 @@
*/
package org.apache.directory.fortress.core.util;
+import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.directory.fortress.core.GlobalIds;
import org.apache.directory.fortress.core.util.attr.VUtil;
@@ -30,8 +31,7 @@ import org.apache.directory.fortress.core.util.attr.VUtil;
*/
public class LogUtil
{
- //final private static Logger log = Logger.getLogger(LogUtil.class.getName());
- private static final org.slf4j.Logger LOG = LoggerFactory.getLogger( LogUtil.class.getName() );
+ private static final Logger LOG = LoggerFactory.getLogger( LogUtil.class.getName() );
/**
@@ -41,35 +41,42 @@ public class LogUtil
*/
public static void logIt(String msg)
{
- if(VUtil.isNotNullOrEmpty( getContext() ))
- msg = getContext() + " " + msg;
-
- if(LOG.isDebugEnabled())
- {
- LOG.debug( msg );
- }
- else if(LOG.isInfoEnabled())
- {
- LOG.info( msg );
- }
- else if(LOG.isWarnEnabled())
+ if ( LOG.isDebugEnabled() || LOG.isInfoEnabled() || LOG.isWarnEnabled() || LOG.isErrorEnabled() )
{
- LOG.warn( msg );
+ if ( VUtil.isNotNullOrEmpty( getContext() ) )
+ {
+ msg = getContext() + " " + msg;
+ }
+
+ if ( LOG.isDebugEnabled() )
+ {
+ LOG.debug( msg );
+ }
+ else if( LOG.isInfoEnabled() )
+ {
+ LOG.info( msg );
+ }
+ else if ( LOG.isWarnEnabled() )
+ {
+ LOG.warn( msg );
+ }
+ else if ( LOG.isErrorEnabled() )
+ {
+ LOG.error( msg );
+ }
}
- else if(LOG.isErrorEnabled())
- {
- LOG.error( msg );
- }
- }
+ }
public static String getContext()
{
String contextId = null;
String tenant = System.getProperty( GlobalIds.TENANT );
+
if ( VUtil.isNotNullOrEmpty( tenant ) && !tenant.equals( "${tenant}" ) )
{
contextId = tenant;
}
+
return contextId;
}
}