2007/08/02
2 Aug, 2007

Changing WSO2 WSAS Logging Properties at Run Time

  • Amila Suriarachchi
  • Architect, Member, Management Committee - Data Technologies - WSO2

In the WSO2 Web Services Application Server (WSAS), not only is it possible to change the logging properties while it is running, but it also stores them in a database that can be retrieved on a server restart.

Like a lot of the Java application servers, WSAS uses the log4j as the logging framework [1]. When talking about log4j, there are three main components which are important. They are Loggers, Appenders, and Layouts. In WSAS, it is possible to change these parameters both globally and individually at run time. When you change the parameters using the WSAS Admin console, first the server stores new values in the database and then changes the appropriate components in the logging framework (hence logging properties are updated immediately). The Logging tab is accessed by clicking the Logging menu in the main menu.

1. Changing Attributes Globally

As shown in the above image, you can set the Log level (severity of the message) and the Log Pattern (the layout pattern which describes the log message format) globally, by updating the desired values. Updating the log level changes the log level of all the appenders to the new log level.

2. Changing Attributes Individually

2.1 Changing Appenders

Currently, WSAS supports four types of appenders. They are SysLogAppender, ConsoleAppender, MemoryAppender, and LogFileAppender. You can select each Appender from the appender name list. Each appender has three basic properties, namely Name, Log Pattern, and Threshold (which is the minimum log level at which you can log a message). In addition to these attributes, the LogFileAppender has the Log File name (which is the location of the file to which the log messages will be written) and the SysLogAppender has the Sys Log Host (the IP address of the system log server) and Facility (the log message type sent to the system log server).

When selecting an appender, only the relevant attributes will be shown. The attributes can be changed by making your desired changes and clicking Update.


The syslog server is a dedicated log server for many applications. It runs in a particular TCP port in a separate machine, which can be identified by an IP address.

Configuring the syslog server is out of the scope of this article, and you should be able to configure the sys log servers with your operating system. For example, to set up the syslog server in the Ubuntu Linux server, first specify the syslog configurations in the /etc/syslog.conf file. After that add the '-r -m0' option to SYSLOGD in the /etc/init.d/sysklogd file. Then restart the server using /etc/init.d/sysklogd -restart command. [2]

2.2 Changing Loggers

When starting the server for the first time, you can either use the default log4.properties file provided with the WSAS distribution, or you can change the default file to add new loggers. Therefore, when the server starts for the first time, it reads the log4j.properties file and stores the content in the database. After that, the logging properties are read-only from the database. All the loggers initially listed in the log4j.properties file appear on the logger name list. Here you can select the logger to edit. Each logger has two attributes called Log level and Additivity (determines whether to use the parent loggers' appenders or not). Click Update to update the Log level and the Additivity.

References

[1] https://logging.apache.org/log4j/docs/manual.html,

https://www.developer.com/open/article.php/10930_3097221_1

[2] https://www.cert-in.org.in/knowledgebase/guidelines/CISG-2004-03.pdf,

https://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=s/sysklogd,

https://en.wikipedia.org/wiki/Syslog

 

 

Author

Amila Suriarachchi, Senior Software Engineer, WSO2 Inc. amila at woso2 dot com

 

About Author

  • Amila Suriarachchi
  • Architect, Member, Management Committee - Data Technologies
  • WSO2 Inc.