com.adventnet.afp.log
Class LogLevel

java.lang.Object
  |
  +--com.adventnet.afp.log.LogLevel

public class LogLevel
extends java.lang.Object

LogLevels are required to filter the log messages based on their severity. When a
particular level is specified, the messages with levels lower than or equal to the
given value will be recorded. This can be configured in the source from where LogConfigReader
would read the configuration details.  In this framework, by default, the LogConfigReader
reads the details from a file. So, this can be  configured in the file logging.xml
through the parameter LogLevel. This parameter enables you to receive the messages
of required severity alone.

Categories of LogLevels :

Following are the three categories of LogLevel.

Level1 - Indicates very important messages  (i.e) Messages of crucial importance
Level2 - Indicates messages of intermediate importance (i.e) Messages that might
cause problems.
Level3 - Indicates normal messages. (i.e) Messages not so important.  Messages of
informational type.

Note : If Level 3 is chosen, all messages belonging to Level 1, 2 and 3 will be written.

Apart from the above 3 levels, there is a fourth level with value 0. This level disables
Logging.

Setting logLevel

The LogLevel can be specified in the source from where LogConfigReader would read the configuration details. In this framework, by default LogConfigReader reads the details from the file logging.xml. So, you can set the LogLevel in that file.

Alternatively, LogLevel can be dynamically set or changed by calling the method setLogLevel(int i) in Logger. Also, you can have different LogLevels for different modules. To illustrate how different LogLevels for different modules can be set, an example has been provided below. In this example, LogLevels have been set for two different modules for receiving server output messages.

<LOGGING>
    <LOG_WRITER>
        <ClassName>com.adventnet.afp.log.FileLogWriter</ClassName>
        <InstanceName>SERVEROUT</InstanceName>
        <PROPERTIES>
            <PROPERTY>
                <Key>FileName</Key>
                <Value>serverout.txt</Value>
            </PROPERTY>
            <PROPERTY>
                <Key>MaxLineCount</Key>
                <Value>1000</Value>
            </PROPERTY>
            <PROPERTY>
                <Key>BufferSize</Key>
                <Value>0</Value>
            </PROPERTY>
            <PROPERTY>
                <Key>FlushMode</Key>
                <Value>AUTO</Value>
           </PROPERTY>
            <PROPERTY>
                <Key>MaxFileCount</Key>
                <Value>10</Value>
            </PROPERTY>
            <PROPERTY>
                <Key>LogDirectory</Key>
                <Value>logs</Value>
            </PROPERTY>
            <PROPERTY>
                <Key>ArchiveStatus</Key>
                <Value>true</Value>
            </PROPERTY>
            <PROPERTY>
                <Key>ArchiveDirectory</Key>
                <Value>logs/archive</Value>
            </PROPERTY>
        </PROPERTIES>
    </LOG_WRITER>
    <LOGGER>
        <ClassName>com.adventnet.afp.log.LoggerImpl</ClassName>
        <InstanceName>MISCOUT</InstanceName>
        <WriterInstanceName>SERVEROUT</WriterInstanceName>
        <LogLevel>3</LogLevel>
        <PROPERTIES>
            <PROPERTY>
                <Key>DisplayName</Key>
                <Value>MISC</Value>
            </PROPERTY>
        </PROPERTIES>
    </LOGGER>
    <LOGGER>
        <ClassName>com.adventnet.afp.log.LoggerImpl</ClassName>
        <InstanceName>TOPOOUT</InstanceName>
        <WriterInstanceName>SERVEROUT</WriterInstanceName>
        <LogLevel>2</LogLevel>
        <PROPERTIES>
            <PROPERTY>
                <Key>DisplayName</Key>
                <Value>TOPO</Value>
            </PROPERTY>
        </PROPERTIES>
</LOGGER>


Field Summary
static int DISABLE
          This level has a value 0.This level disables logging .
static int LEVEL1
          This level has a value 1.
static int LEVEL2
          This level has a value 2.This level indicates very important messages(i.e) Messages of intermediate importance .The message with level less than or equal 2 will be logged in this level.
static int LEVEL3
          This level has a value 3.This level indicates very important messages(i.e) Messages not so important .The message whose level less than or equal 3 will be logged in this level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL1

public static final int LEVEL1
This level has a value 1. This level indicates very important messages(i.e) Messages of crucial importance .The message with level less than or equal 1 will be logged in this level.

LEVEL2

public static final int LEVEL2
This level has a value 2.This level indicates very important messages(i.e) Messages of intermediate importance .The message with level less than or equal 2 will be logged in this level.

LEVEL3

public static final int LEVEL3
This level has a value 3.This level indicates very important messages(i.e) Messages not so important .The message whose level less than or equal 3 will be logged in this level.

DISABLE

public static final int DISABLE
This level has a value 0.This level disables logging .


Copyright (c)AdventNet Inc., 1996-2004