<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.infinite-erp.co.id/index.php?action=history&amp;feed=atom&amp;title=How_To_Configure_Log_Using_Log4j1.x</id>
	<title>How To Configure Log Using Log4j1.x - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.infinite-erp.co.id/index.php?action=history&amp;feed=atom&amp;title=How_To_Configure_Log_Using_Log4j1.x"/>
	<link rel="alternate" type="text/html" href="https://wiki.infinite-erp.co.id/index.php?title=How_To_Configure_Log_Using_Log4j1.x&amp;action=history"/>
	<updated>2026-04-06T21:44:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.infinite-erp.co.id/index.php?title=How_To_Configure_Log_Using_Log4j1.x&amp;diff=2726&amp;oldid=prev</id>
		<title>Wikiadmin: Created page with &quot;{{(!)| Starting from '''PR19Q1''' Openbravo uses [https://logging.apache.org/log4j/2.x/ log4j2] for logging. If you're using this version or newer, please refer to How_To_Co...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.infinite-erp.co.id/index.php?title=How_To_Configure_Log_Using_Log4j1.x&amp;diff=2726&amp;oldid=prev"/>
		<updated>2021-12-16T01:05:54Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{(!)| Starting from &amp;#039;&amp;#039;&amp;#039;PR19Q1&amp;#039;&amp;#039;&amp;#039; Openbravo uses [https://logging.apache.org/log4j/2.x/ log4j2] for logging. If you&amp;#039;re using this version or newer, please refer to How_To_Co...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{(!)| Starting from '''PR19Q1''' Openbravo uses [https://logging.apache.org/log4j/2.x/ log4j2] for logging. If you're using this version or newer, please refer to [[How_To_Configure_Log]] to configure log using log4j 2.x. }}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Logging allows developers to insert messages when code is executed, these messages can be used to understand different issues in the backend code, such as errors, performance problems, etc.&lt;br /&gt;
&lt;br /&gt;
Openbravo uses [http://logging.apache.org/log4j/1.2/ log4j] to log.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Logging is configured by &amp;lt;code&amp;gt;log4j.lcf&amp;lt;/code&amp;gt; file in Openbravo's &amp;lt;code&amp;gt;config&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
=== File ===&lt;br /&gt;
&lt;br /&gt;
Typically log is redirected to a file. This file is determined by log4j.appender.*.File property. The defaults are:&lt;br /&gt;
&lt;br /&gt;
 log4j.appender.R=org.apache.log4j.RollingFileAppender&lt;br /&gt;
 log4j.appender.R.File=${catalina.base}/logs/openbravo.log&lt;br /&gt;
&lt;br /&gt;
 log4j.appender.HB=org.apache.log4j.RollingFileAppender&lt;br /&gt;
 log4j.appender.HB.File=${catalina.base}/logs/openbravo_hibernate.log&lt;br /&gt;
&lt;br /&gt;
With this configuration, regular log will be placed in &amp;lt;code&amp;gt;openbravo.log&amp;lt;/code&amp;gt; file in tomcat's log directory and log for hibernate will be in the same directory in &amp;lt;code&amp;gt;openbravo_hibernate.log&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
=== Log Verbosity ===&lt;br /&gt;
&lt;br /&gt;
Verbosity in the log is defined by the log levels:&lt;br /&gt;
&lt;br /&gt;
ERROR&lt;br /&gt;
WARN&lt;br /&gt;
INFO&lt;br /&gt;
DEBUG&lt;br /&gt;
&lt;br /&gt;
Developer decides which is the level of each of the messages sent to the log.&lt;br /&gt;
&lt;br /&gt;
It is possible to configure the log to display messages starting from any of these levels. Default configuration shows INFO and above. Log level can be configured globally and/or per class/package.&lt;br /&gt;
&lt;br /&gt;
This can be modified in 2 ways:&lt;br /&gt;
&lt;br /&gt;
* In &amp;lt;code&amp;gt;log4j.lcf&amp;lt;/code&amp;gt;, it requires to deploy the changes (&amp;lt;code&amp;gt;ant smartbuild&amp;lt;/code&amp;gt;) and restart Tomcat after modifying.&lt;br /&gt;
** Globally: Change &amp;lt;code&amp;gt;log4j.rootCategory='''INFO'''&amp;lt;/code&amp;gt; to the desired level.&lt;br /&gt;
** Per Java class or package: add lines like &amp;lt;code&amp;gt;log4j.category.''your.path.here''=DEBUG&amp;lt;/code&amp;gt; where &amp;lt;code&amp;gt;''your.path''&amp;lt;/code&amp;gt; is the fully qualified class name or pacakage.&lt;br /&gt;
* At runtime. The change doesn't require Tomcat to be restarted to be effective, but after restarting it configuration will be read from &amp;lt;code&amp;gt;log4j.lcf&amp;lt;/code&amp;gt; and changes will be lost. To do it, log in the application as System Administrator, open ''Session Preferences'' window, click on ''Change Logs'' button, select the class you want to modify the log level for, select log level and click on ''Process'' button.&lt;br /&gt;
&lt;br /&gt;
[[Image:Log-config.png|center|600px]]&lt;br /&gt;
&lt;br /&gt;
== Rotation ==&lt;br /&gt;
In order to prevent log file to constantly increase, rotation is defined. Rotation sets up the policy to decide when log file will be archived and how many archives will be maintained. &lt;br /&gt;
&lt;br /&gt;
It is configured with the following properties:&lt;br /&gt;
&lt;br /&gt;
  log4j.appender.R.MaxFileSize=10000KB&lt;br /&gt;
  log4j.appender.R.MaxBackupIndex=10&lt;br /&gt;
&lt;br /&gt;
In this example, log file will have at most 10MB. When this size is reached, current log is archived and a new log empty file is created, it will also keep up to 10 files, so when a new archive is created, the oldest existing one will be deleted.&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Wikiadmin</name></author>
		
	</entry>
</feed>