Skip to content

Commit

Permalink
MONDRIAN: Replace the simple logger, mondrian/olap/Log.java, with log4j.
Browse files Browse the repository at this point in the history
       The abstract base classes define the method:
           protected abstract Logger getLogger();
       which is defined in derived classes thus allowing the base class
       to use the derived class' logger.
       The CmdRunner now allow the querying and setting of log4j loggers.
       The log4j.properties is an example log4j configuration file. To
       use it one must define the system property, log4j.configuration,
       with the url of the file, i.e., 
           log4j.configuration=file://$MONDRIAN_HOME/log4j.properties

[git-p4: depot-paths = "//open/mondrian/": change = 3271]
  • Loading branch information
Richard Emberson committed Mar 1, 2005
1 parent 0957f35 commit d0f3c8e
Show file tree
Hide file tree
Showing 21 changed files with 237 additions and 377 deletions.
Binary file added lib/log4j-1.2.9.jar
Binary file not shown.
19 changes: 19 additions & 0 deletions log4j.properties
@@ -0,0 +1,19 @@
#
# Example log4j properties file
#
# $Id$
#
# Set root logger level to DEBUG and its only appender to MONDRIAN.
log4j.rootLogger=WARN, MONDRIAN

# MONDRIAN is set to be a ConsoleAppender.
log4j.appender.MONDRIAN=org.apache.log4j.ConsoleAppender

# MONDRIAN uses PatternLayout.
log4j.appender.MONDRIAN.layout=org.apache.log4j.PatternLayout
log4j.appender.MONDRIAN.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n



# Example of setting on a class basis
#log4j.category.mondrian.rolap.RolapCube=DEBUG, MONDRIAN
4 changes: 4 additions & 0 deletions src/main/mondrian/olap/ConnectionBase.java
Expand Up @@ -12,6 +12,8 @@

package mondrian.olap;

import org.apache.log4j.Logger;

/**
* <code>ConnectionBase</code> implements some of the methods in
* {@link Connection}.
Expand All @@ -26,6 +28,8 @@ public abstract class ConnectionBase implements Connection
protected ConnectionBase() {
}

protected abstract Logger getLogger();

public String getFullConnectString()
{
String s = getConnectString(),
Expand Down
5 changes: 3 additions & 2 deletions src/main/mondrian/olap/DimensionBase.java
Expand Up @@ -26,6 +26,7 @@ public abstract class DimensionBase
extends OlapElementBase
implements Dimension
{

protected final String name;
protected final String uniqueName;
protected final String description;
Expand Down Expand Up @@ -79,7 +80,7 @@ public OlapElement lookupChild(SchemaReader schemaReader, String s)
oe = getHierarchy().lookupChild(schemaReader, s);
}

if (Log.isTrace()) {
if (getLogger().isDebugEnabled()) {
StringBuffer buf = new StringBuffer(64);
buf.append("DimensionBase.lookupChild: ");
buf.append("name=");
Expand All @@ -91,7 +92,7 @@ public OlapElement lookupChild(SchemaReader schemaReader, String s)
} else {
buf.append(" returning elementname="+oe.getName());
}
Log.trace(buf.toString());
getLogger().debug(buf.toString());
}


Expand Down
4 changes: 2 additions & 2 deletions src/main/mondrian/olap/HierarchyBase.java
Expand Up @@ -92,7 +92,7 @@ public OlapElement lookupChild(SchemaReader schemaReader, String s)
if (oe == null) {
oe = Util.lookupHierarchyRootMember(schemaReader, this, s);
}
if (Log.isTrace()) {
if (getLogger().isDebugEnabled()) {
StringBuffer buf = new StringBuffer(64);
buf.append("HierarchyBase.lookupChild: ");
buf.append("name=");
Expand All @@ -104,7 +104,7 @@ public OlapElement lookupChild(SchemaReader schemaReader, String s)
} else {
buf.append(" returning elementname="+oe.getName());
}
Log.trace(buf.toString());
getLogger().debug(buf.toString());
}
return oe;
}
Expand Down
303 changes: 0 additions & 303 deletions src/main/mondrian/olap/Log.java

This file was deleted.

0 comments on commit d0f3c8e

Please sign in to comment.