| Home >> All >> org >> apache >> [ log4j Javadoc ] |
Page 1 2
| | org.apache.log4j.performance.* (8) | | org.apache.log4j.spi.* (18) | | org.apache.log4j.varia.* (11) |
| | org.apache.log4j.xml.* (8) |
org.apache.log4j: Javadoc index of package org.apache.log4j.
Package Samples:
org.apache.log4j.varia.test: Contains various appenders, filters and other odds and ends.
org.apache.log4j.xml: The main log4j package.
org.apache.log4j.xml.test: XML based components.
org.apache.log4j.performance
org.apache.log4j.spi
org.apache.log4j.varia
org.apache.log4j.xml.examples
Classes:
PatternLayout: A flexible layout configurable with pattern string. The goal of this class is to format 55 a org.apache.log4j.spi.LoggingEvent and return the results as a String. The results depend on the conversion pattern . The conversion pattern is closely related to the conversion pattern of the printf function in C. A conversion pattern is composed of literal text and format control expressions called conversion specifiers . You are free to insert any literal text within the conversion pattern. Each conversion specifier starts with a percent sign (%) and is followed by optional format modifiers and a conversion ...
SocketHubAppender: Sends org.apache.log4j.spi.LoggingEvent objects to a set of remote log servers, usually a SocketNodes . Acts just like SocketAppender except that instead of connecting to a given remote log server, SocketHubAppender accepts connections from the remote log servers as clients. It can accept more than one connection. When a log event is received, the event is sent to the set of currently connected remote log servers. Implemented this way it does not require any update to the configuration file to send data to another remote log server. The remote log server simply connects to the host and port the ...
NDC: The NDC class implements nested diagnostic contexts as defined by Neil Harrison in the article "Patterns for Logging Diagnostic Messages" part of the book " Pattern Languages of Program Design 3 " edited by Martin et al. A Nested Diagnostic Context, or NDC in short, is an instrument to distinguish interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simultaneously. Interleaved log output can still be meaningful if each log entry from different contexts had a distinctive stamp. This is where NDCs come into play. Note that ...
Logging: Measure the performance of logging. Experimental results are listed below in units of micro-seconds . Measurements were done on a AMD Duron clocked at 800Mhz running Windows 2000 and Sun's 1.3 JDK. Layout NullAppender FileAppender FileAppender (no flush) AsyncAppender (no flush) SimpleLayout 4 21 16 33 PatternLayout "%p - %m%n" 4 21 16 32 PatternLayout "%-5p - %m%n" 4 NA NA NA TTCCLayout/RELATIVE 10 37 31 45 PatternLayout "%r [%t] %-5p %c{2} %x - %m%n" 11 NA NA NA PatternLayout "%r [%t] %-5p %.10c %x - %m%n" 11 NA NA NA PatternLayout "%r [%t] %-5p %.20c %x - %m%n" 11 NA NA NA PatternLayout "%r ...
DailyRollingFileAppender: DailyRollingFileAppender extends FileAppender so that the underlying file is rolled over at a user chosen frequency. The rolling schedule is specified by the DatePattern option. This pattern should follow the java.text.SimpleDateFormat conventions. In particular, you must escape literal text within a pair of single quotes. A formatted version of the date pattern is used as the suffix for the rolled file name. For example, if the File option is set to /foo/bar.log and the DatePattern set to '.'yyyy-MM-dd , on 2001-02-16 at midnight, the logging file /foo/bar.log will be copied to /foo/bar.log.2001-02-16 ...
SocketAppender: Sends org.apache.log4j.spi.LoggingEvent objects to a remote a log server, usually a SocketNode . The SocketAppender has the following properties: If sent to a SocketNode , remote logging is non-intrusive as far as the log event is concerned. In other words, the event will be logged with the same time stamp, org.apache.log4j.NDC , location info as if it were logged locally by the client. SocketAppenders do not use a layout. They ship a serialized org.apache.log4j.spi.LoggingEvent object to the server side. Remote logging uses the TCP protocol. Consequently, if the server is reachable, then log events ...
NewVsSetLen: This program compares the cost of creating a new StringBuffer and converting it to a String versus keeping the same StringBuffer, setting its size to zero and then converting it to String. The table below gives some figures. Total Message length 0 1 2 4 8 New Buffer setLength New Buffer setLength New Buffer setLength New Buffer setLength New Buffer setLength 256 33 22 34 22 34 22 34 22 33 23 1024 58 41 59 45 59 48 59 51 60 44 4096 146 132 138 132 144 126 142 132 136 132 16384 617 593 593 609 601 617 601 632 593 632 65536 3218 3281 3093 3125 3125 3156 3125 3281 3062 3562 262144 14750 15125 14000 ...
JMSAppender: A simple appender that publishes events to a JMS Topic. The events are serialized and transmitted as JMS message type javax.jms.ObjectMessage . JMS topics and topic connection factories are administered objects that are retrieved using JNDI messaging which in turn requires the retreival of a JNDI javax.naming.Context . There are two common methods for retrieving a JNDI javax.naming.Context . If a file resource named jndi.properties is available to the JNDI API, it will use the information found therein to retrieve an initial JNDI context. To obtain an initial context, your code will simply call: ...
SocketServer: A SocketNode based server that uses a different hierarchy for each client. Usage: java org.apache.log4j.net.SocketServer port configFile configDir where port is a part number where the server listens, configFile is a configuration file fed to the org.apache.log4j.PropertyConfigurator and configDir is a path to a directory containing configuration files, possibly one for each client host. The configFile is used to configure the log4j default hierarchy that the SocketServer will use to report on its actions. When a new connection is opened from a previously unknown host, say foo.bar.net , then the ...
TTCCLayout: TTCC layout format consists of time, thread, category and nested diagnostic context information, hence the name. Each of the four fields can be individually enabled or disabled. The time format depends on the DateFormat used. Here is an example TTCCLayout output with the org.apache.log4j.helpers.RelativeTimeDateFormat . 176 [main] INFO org.apache.log4j.examples.Sort - Populating an array of 2 elements in reverse order. 225 [main] INFO org.apache.log4j.examples.SortAlgo - Entered the sort method. 262 [main] DEBUG org.apache.log4j.examples.SortAlgo.OUTER i=1 - Outer loop. 276 [main] DEBUG org.apache.log4j.examples.SortAlgo.SWAP ...
Filter: Users should extend this class to implement customized logging event filtering. Note that org.apache.log4j.Category and org.apache.log4j.AppenderSkeleton , the parent class of all standard appenders, have built-in filtering rules. It is suggested that you first use and understand the built-in rules before rushing to write your own custom filters. This abstract class assumes and also imposes that filters be organized in a linear chain. The decide(LoggingEvent) 55 method of each filter is called sequentially, in the order of their addition to the chain. The decide(LoggingEvent) 55 method must return ...
PropertyConfigurator: Allows the configuration of log4j from an external file. See doConfigure(String, LoggerRepository) 55 for the expected format. It is sometimes useful to see how log4j is reading configuration files. You can enable log4j internal logging by defining the log4j.debug variable. As of log4j version 0.8.5, at class initialization time class, the file log4j.properties will be searched from the search path used to load classes. If the file can be found, then it will be fed to the configure(java.net.URL) 55 method. The PropertyConfigurator does not handle the advanced configuration features supported by ...
DatagramStringAppender: Use DatagramStringAppender to send log messages to a remote daemon which accepts Datagram (UDP) messages. The benefits of UDP are that the client is guarunteed not to slow down if the network or remote log daemon is slow, and that no permanent TCP connection between client and server exists. The disadvantages are that log messages can be lost if the network or remote daemon are under excessive load. This class builts the final message string before sending the UDP packet, hence the "string" component in the class name. This means that the receiving application can be written in any language. The ...
CompositeRollingAppender: CompositeRollingAppender combines RollingFileAppender and DailyRollingFileAppender It can function as either or do both at the same time (making size based rolling files like RollingFileAppender until a data/time boundary is crossed at which time it rolls all of those files as per the DailyRollingFileAppender) based on the setting for rollingStyle . To use CompositeRollingAppender to roll log files as they reach a certain size (like RollingFileAppender), set rollingStyle=1 (@see config.size) To use CompositeRollingAppender to roll log files at certain time intervals (daily for example), set rollingStyle=2 ...
JDBCAppender: WARNING: This version of JDBCAppender is very likely to be completely replaced in the future. Moreoever, it does not log exceptions . The JDBCAppender provides for sending log events to a database. Each append call adds to an ArrayList buffer. When the buffer is filled each log event is placed in a sql statement (configurable) and executed. BufferSize , db URL , User , & Password are configurable options in the standard log4j ways. The setSql(String sql) sets the SQL statement to be used for logging -- this statement is sent to a PatternLayout (either created automaticly by the appender or added ...
LevelRangeFilter: This is a very simple filter based on level matching, which can be used to reject messages with priorities outside a certain range. The filter admits three options LevelMin , LevelMax and AcceptOnMatch . If the level of the org.apache.log4j.spi.LoggingEvent is not between Min and Max (inclusive), then Filter.DENY > Filter.DENY 55 is returned. If the Logging event level is within the specified range, then if AcceptOnMatch is true, Filter.ACCEPT > Filter.ACCEPT 55 is returned, and if AcceptOnMatch is false, Filter.NEUTRAL > Filter.NEUTRAL 55 is returned. If LevelMin w is not defined, then there is ...
XMLLayout: The output of the XMLLayout consists of a series of log4j:event elements as defined in the log4j.dtd . It does not output a complete well-formed XML file. The output is designed to be included as an external entity in a separate file to form a correct XML file. For example, if abc is the name of the file where the XMLLayout ouput goes, then a well-formed XML file would be: <?xml version="1.0" ?> <!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd" [<!ENTITY data SYSTEM "abc">]> <log4j:eventSet version="1.2" xmlns:log4j="http://jakarta.apache.org/log4j/"> &data; </log4j:eventSet> ...
LevelMatchFilter: This is a very simple filter based on level matching. The filter admits two options LevelToMatch and AcceptOnMatch . If there is an exact match between the value of the LevelToMatch option and the level of the org.apache.log4j.spi.LoggingEvent , then the decide(org.apache.log4j.spi.LoggingEvent) 55 method returns Filter.ACCEPT > Filter.ACCEPT 55 in case the AcceptOnMatch option value is set to true , if it is false then Filter.DENY > Filter.DENY 55 is returned. If there is no match, Filter.NEUTRAL > Filter.NEUTRAL 55 is returned.
StringMatchFilter: This is a very simple filter based on string matching. The filter admits two options StringToMatch and AcceptOnMatch . If there is a match between the value of the StringToMatch option and the message of the org.apache.log4j.spi.LoggingEvent , then the decide(LoggingEvent) 55 method returns Filter.ACCEPT > Filter.ACCEPT 55 if the AcceptOnMatch option value is true, if it is false then Filter.DENY > Filter.DENY 55 is returned. If there is no match, Filter.NEUTRAL > Filter.NEUTRAL 55 is returned.
NotLogging: Measure the performance of evaluating whether to log or not to log, but not actually logging. This program takes two arguments, a string which should be "true" for testing shipped code performance and "false" for testing debug-enabled performance the second argument is the run length of the measurement loops. The results of the measurement (should) show that Category evaluation is independent of the length of the category name. As expected, using the isDebugEnabled 55 and isInfoEnabled 55 methods eliminates the overhead of message argument construction. Message argument construction can be an important ...
PropertySetter: General purpose Object property setter. Clients repeatedly invokes setProperty(name,value) 55 in order to invoke setters on the Object specified in the constructor. This class relies on the JavaBeans java.beans.Introspector to analyze the given Object Class using reflection. Usage: PropertySetter ps = new PropertySetter(anObject); ps.set("name", "Joe"); ps.set("age", "32"); ps.set("isMale", "true"); will cause the invocations anObject.setName("Joe"), anObject.setAge(32), and setMale(true) if such methods exist with those signatures. Otherwise an java.beans.IntrospectionException are thrown.
DailyFileAppender: DailyFileAppender extends FileAppender to use filenames formatted with date/time information. The filename is recomputed every day at midnight. Note that the filename doesn't have to change every day, making it possible to have logfiles which are per-week or per-month. The appender computes the proper filename using the formats specified in java.text.SimpleDateFormat . The format requires that most static text is enclosed in single quotes, which are removed. The examples below show how quotes are used to embed static information in the format. Sample filenames: Filename pattern Filename "'/logs/trace-'yyyy-MM-dd'.log'" ...
Hierarchy: This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy. The casual user does not have to deal with this class directly. The structure of the logger hierarchy is maintained by the getLogger(java.lang.String) 55 method. The hierarchy is such that children link to their parent but parents do not have any pointers to their children. Moreover, loggers can be instantiated in any order, in particular descendant before ancestor. In case a descendant is created before a particular ancestor, then it creates a provision node for the ancestor and adds itself to the ...
MDC: The MDC class is similar to the NDC class except that it is based on a map instead of a stack. It provides mapped diagnostic contexts . A Mapped Diagnostic Context , or MDC in short, is an instrument for distinguishing interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simultaneously. The MDC is managed on a per thread basis . A child thread automatically inherits a copy of the mapped diagnostic context of its parent. The MDC class requires JDK 1.2 or above. Under JDK 1.1 the MDC will always return empty values but otherwise ...
ExternallyRolledFileAppender: This appender listens on a socket on the port specified by the Port property for a "RollOver" message. When such a message is received, the underlying log file is rolled over and an acknowledgment message is sent back to the process initiating the roll over. This method of triggering roll over has the advantage of being operating system independent, fast and reliable. A simple application Roller is provided to initiate the roll over. Note that the initiator is not authenticated. Anyone can trigger a rollover. In production environments, it is recommended that you add some form of protection to ...
| Home | Contact Us | Privacy Policy | Terms of Service |