SUMMARY / RELATED TOPICS

Java logging framework

A Java logging framework is a computer data logging package for the Java platform. This article covers general purpose logging frameworks. Logging refers to the recording of activity by an application and is a common issue for development teams. Logging frameworks standardize the process of logging for the Java platform. In particular they provide flexibility by avoiding explicit output to the console. Where logs are written becomes independent of the code and can be customized at runtime; the JDK did not include logging in its original release so by the time the Java Logging API was added several other logging frameworks had become used - in particular Apache Commons Logging and log4j. This led to problems when integrating different third-party libraries each using different logging frameworks. Pluggable logging frameworks were developed to solve this problem. Logging is broken into three major pieces: the Logger, the Formatter and the Appender; the Logger is responsible for capturing the message to be logged along with certain metadata and passing it to the logging framework.

After receiving the message, the framework calls the Formatter with the message which formats it for output. The framework hands the formatted message to the appropriate Appender/Handler for disposition; this might include output to a console display, writing to disk, appending to a database, or generating an email. Simpler logging frameworks, like Logging Framework by the Object Guy, combine the logger and the appender; this simplifies default operation, but it is less configurable if the project is moved across environments. A Logger is an object that allows the application to log without regard to where the output is sent/stored; the application logs a message by passing an object or an object and an exception with an optional severity level to the logger object under a given name/identifier. A logger has a name; the name is structured hierarchically, with periods separating the levels. A common scheme is to use the name of the class or package, doing the logging. Both log4j and the Java logging API support defining handlers higher up the hierarchy.

For example, the logger might be named "com.sun.some. UsefulClass"; the handler can be defined for any of the following: com com.sun com.sun.some com.sun.some. UsefulClassAs long as there is a handler defined somewhere in this stack, logging may occur. For example a message logged to the com.sun.some. UsefulClass logger, may get written by the com.sun handler. There is a global handler that receives and processes messages generated by any logger; the message is logged at a certain level. Common level names are copied from Apache Commons Logging: The logging framework maintains the current logging level for each logger; the logging level can be set less restrictive. For example, if the logging level is set to "WARNING" all messages of that level or higher are logged: ERROR and FATAL. Severity levels can be assigned to both appenders. Both must be enabled for a given severity level for output to be generated. So a logger enabled for debug output will not generate output if the handler that gets the message is not enabled for debug.

Filters cause a log event to be logged. The most used filter is the logging level documented in the previous section. Logging frameworks such as Log4j 2 and SLF4J provide Markers, which when attached to a log event can be used for filtering. Filters can be used to accept or deny log events based on exceptions being thrown, data within the log message, data in a ThreadLocal, exposed through the logging API, or a variety of other methods. A Formatter is an object; this consists of taking the binary object and converting it to a string representation. Each framework defines a default output format. Appenders listen for messages above a specified minimum severity level; the Appender takes the message it is posts it appropriately. Message dispositions include: display on the console write to a file or syslog append to a database table distribute via Java Messaging Services send via email write to a socket discard to the "bit-bucket" JCL and Log4j are common because they have been around for so long and were the only choices for a long time.

The flexibility of slf4j has made it a popular choice. SLF4J is a set of logging wrappers, thus multiple third-party libraries can be incorporated into an application, regardless of the logging framework each has chosen to use. However all logging output is generated in a standard way via Logback. Log4j 2 provides both an implementation; the API can be routed to other logging implementations equivalent to. Unlike SLF4J, the Log4j 2 API logs Message objects instead of Strings for extra flexibility and supports Java Lambda expressions. JCL isn't a logging framework, but a wrapper for one; as such, it requires a logging framework underneath it, although it can default to using its own SimpleLog logger. JCL, SLF4J and the Log4j 2 API are useful when developing reusable libraries which need to write to whichever underlying logging system is being used by the application; this provides flexibility in heterogeneous environments where the logging framework is to change, although in most cases, once a logging framework has been chosen, there is little need to change it over the life of the project.

SLF4J and Log4j 2 benefit from being n

Eddie Stumpf

Edward Stumpf was an American player and executive in Minor league baseball. Stumpf began his professional baseball career as a catcher in the American Association, playing from 1916 through 1919 for the Milwaukee Brewers and Columbus Senators. After that he coached and scouted for the Brewers for several years, before becoming a manager in 1939 with the Tarboro Serpents in the Class-D Coastal Plain League. From 1941 to 1942, Stumpf managed and caught for the Janesville Cubs of the Wisconsin State League, until he heard about the All-American Girls Professional Baseball League, an innovative circuit conceived by Philip K. Wrigley, a chewing-gum magnate who had inherited the Chicago Cubs Major League Baseball franchise from his father. Stumpf took the opportunity to get news at first hand; the All-American Girls Professional Baseball League play began on May 30, 1943 with four teams, the Kenosha Comets, Racine Belles, Rockford Peaches and South Bend Blue Sox. Stumpf became one of the first four managers being assigned to the Rockford club.

The other managers selected were Johnny Gottselig, an experimented ice hockey left winger who played 17 seasons for the Chicago Black Hawks, former big leaguers Josh Billings and Bert Niehoff. Stumpf appeared in the league's first All-Star Game during the 1943 midseason, played under temporary lights at Wrigley Field, between two teams composed of Blue Sox and Peaches players versus Comets and Belles players, it was the first night game played in the historic ballpark. After that, Stumpf was an active scout for the league during the rest of the decade and served a second stint as manager in 1945, he has been credited for switching Dorothy Kamenshek from outfield to first base after just 12 games for the Peaches. A perennial All-Star and two-time champion bat, Kamenshek was considered by former New York Yankees first baseman Wally Pipp, as the fanciest-fielding first sacker he had seen among men or women. Stumpf moved into the front offices, he joined the Cleveland Indians organization in 1950, first as business director of Cleveland minor league system and was promoted as general manager for Triple-A Indianapolis Indians in 1953.

While working for the Indians, he provided assistance in the development and monitoring of future big leaguers as Hank Aguirre, Joe Altobelli, Rocky Colavito and Al Smith, among others. Stumpf was a long resident of Milwaukee, where he died at the age of 84, he is part of the AAGPBL permanent display at the Baseball Hall of Fame and Museum at Cooperstown, New York opened in 1988, dedicated to the entire league rather than any individual player