Many of the available Java logging tools and frameworks share a common list of concepts and features. Additional tools include additional logging capabilities, protocols, filtering mechanism and even graphical viewer and monitoring tools. See below for a list of basic and advanced features of Java logging frameworks. This should be a good starting point to learn more about important features and concepts when evaluating and selecting a Java logging tool.

SmartInspect Java Logging

Key Features and Concepts of Java Logging Frameworks

If you are new to logging and tracing, please see below for a short summary of the key concepts and features of logging frameworks and libraries.

  • [Basic] Logging simple text messages
    The most basic feature of all logging frameworks is the ability to log and write simple text messages such as debug information or errors and related information like timestamps to a log file.

  • [Basic] Log levels to filter messages
    Most logging tools allow developers to specify a log level such as debug, info, warning and error for each log level and filter these messages by severity. In a production environment, administrators and support staff might only be interested in warnings and errors, while developers need more detailed messages during debugging.

  • [Basic] Multiple connections or targets
    Logging frameworks often allow developers to write or send the logging information to multiple connections or targets and support multiple protocols such as log files or network connections. The desired connections and targets can be changed at run-time by changing an application setting.

  • [Basic] Log categories or sessions
    Most tracing and logging libraries support a feature to group related logging messages into categories or sessions. This allows developers to group all log entries of a specific application module or user session and enable or disable logging for this group of messages independently from other logging code.

  • [Basic] Log file rotation
    When an application is running for longer periods (such as server applications or batch processes that are executed daily over multiple months), it is often necessary to split log files into multiple smaller files. Log file rotation, a feature supported by most serious logging frameworks, splits log files in chunks of predefined time periods or file sizes. This could result, for example, in a separate log file for each day with a unique file name that indicates that day's date.

  • [Basic] Loading logging settings from a configuration file
    Some logging libraries allow loading logging settings from a configuration file. This allows developers and support staff to easily change logging settings at run-time without changing the application or building their own configuration infrastructure.

  • [Advanced] High logging throughput and performance
    As logging is often used during production usage and not just while debugging an application, performance is a critical factor when choosing a logging framework.

  • [Advanced] Logging objects and other data
    Some logging tools also support logging of complex data structures such as entire objects, binary data, exception stack traces, screenshots, database results and more, allowing developers to make more sense out of the logging data compared to just logging simple text messages.

  • [Advanced] Thread-safe logging
    An important feature of serious logging libraries is thread-safety. This means that it's possible to call and access the same logger object from multiple threads without causing any deadlocks, race conditions or other thread-related issues. Additionally, the synchronization mechanism should be as fast and unobtrusive as possible to minimize thread locking.

  • [Advanced] Tracing method invocation
    Tracing method invocation allows developers to easily understand which methods are called, in what order they are called and how much time they need to execute. This is especially useful to optimize and fine-tune code and to understand and follow application logic and errors.

  • [Advanced] Watching and logging variable values
    It's often useful to log and watch variable values separately from log messages in order to follow variable values and system information such as database connections, thread count and memory usage.

  • [Advanced] Logging thread and process behavior
    When developing distributed and/or multi-threading applications, it's often useful to know how many threads and processes are running, what each thread is doing and how long a thread or process has been running. Advanced logging frameworks allow developers to log thread and process behavior.

  • [Advanced] Advanced protocols and options
    Advanced protocols such as logging to memory or logging via named pipes are important to customize logging to specific application requirements. Advanced protocol options such as reconnect, reconnect interval and buffers allow fine-tuning of protocols and connections for production usage.

  • [Advanced] Asynchronous logging and backlog queues
    To reduce the blocking of application code in high-performance and scalable applications, asynchronous logging and backlog queues allow developers to fine-tune logging in regards to production performance and locking behavior.

  • [Advanced] Log server application
    In situations where a central log storage is needed or when multiple processes should log to the same file, a log server is needed to receive logging data from multiple sources and merge them in a central location. Advanced logging frameworks already include a compatible log server.

  • [GUI] Graphical viewer application
    A graphical viewer application that helps analyzing logging data and monitoring applications in real-time can drastically reduce the time spent on finding run-time issues, following application logic and fixing application errors. A graphical viewer application is a great aid and should be included in any advanced logging package (or should alternatively be available as a separate download or product).

  • [GUI] Advanced filtering capabilities
    A useful viewer application should allow filtering for different log entry attributes such as category/session, application, thread ID, process ID, log entry type, timestamp or text message. Filtering is especially important when analyzing log files with huge amounts of log entries.

  • [GUI] Navigation functionality
    Special features that make it easier navigating through logs such as jumping between log entries, navigating to methods and finding specific messages is a must-have feature for log viewer tools.

  • [GUI] Call stacks, graphs and message details
    Separate windows to view call stacks, graphs for variable values and message details help making sense out of big log files and when monitoring applications in real-time.

  • [GUI] Multiple views or windows
    It's often useful to view log entries of different application modules, threads or processes in separate views or windows. This allows developers to easily understand what each thread is working on and where application errors occur. Advanced viewer applications also allow the automatic creation of views for certain criteria such as for new threads, processes or application modules.

  • [GUI] Live monitoring via network or pipes
    One of the most useful features of viewer applications is the ability to monitor applications in real-time by receiving log messages via the network or (named) pipes. This allows developers and administrators to monitor production systems and spot errors as they occur.

  • [GUI] Viewing and inspecting application data
    Besides viewing log messages and related information such as call stacks, some viewer applications also render additional application data attached to log entries such as images (e.g. screenshots), database results, script files, object properties, binary data and more. This makes it easy to inspect and validate application data.

  • [GUI] Graphical configuration utility
    A graphical utility to create logging configuration files is often useful as the amount of available logging protocols and options are often quite overwhelming. Such a tool makes it a lot easier to create configuration files without the need to look up every protocol option in the online help.

SmartInspect Java Logging