...
In Colored Trails Log4J is configured to log all log statements (debug and lower) to stdout.
Logging to MySQL
...
- Please note that the following instructions only concern the Colored Trails trunk*
You may want to log your server output to a database. Log4J supports a JDBC Appender to log to a MySQL database. You can activate the JDBC Appender for the Colored Trails project by simply some uncommenting a few lines in the log4j.properties file.
To create a database and a table for the JDBC Appender to log to, use the SQL commands below.
Code Block | ||
---|---|---|
| ||
CREATE DATABASE IF NOT EXISTS db_name where db_name is the name of the database you would like to create. |
Code Block |
---|
CREATE TABLE `table_name` ( `Id` int(11) NOT NULL auto_increment, `Logger` varchar(64) default NULL, `Priority` varchar(10) default NULL, `Message` varchar(250) default NULL, `Date` varchar(40) default NULL, PRIMARY KEY (`Id`) ) ENGINE=MyISAM AUTO_INCREMENT=1005 DEFAULT CHARSET=utf8 |
An example
Every Java class in the CT code can use the log4J mechanism. An example:
...