GO Loader Aviation 1.2 is here! Take a look at what's new.
Skip to end of metadata
Go to start of metadata

Set up and configure Workflow logging (Optional)

 

The logging setup process differs between WildFly deployments and WebLogic deployments. In WebLogic logging is configured in the logback.xml configuration file, while in WildFly logging is configured in the standalone.xml configuration file.

Click the link below that matches your chosen application server.

 Logging in Wildfly 10

 WildFly 10

To configure logging in WildFly 10 you need to make some adjustments to the standalone.xml configuration file of your WildFly instance. The standalone.xml document can be found in the following location:

/wildfly-10.0.0.Final/standalone/configuration/standalone.xml

Open the standalone file in a text viewer and locate the <subsystem xmlns="urn:jboss:domain:logging:3.0"> element. You need to replace this element with the example logging configuration provided below:

 Example Logging Configuration
<subsystem xmlns="urn:jboss:domain:logging:3.0">
			<use-deployment-logging-config value="false"/>
			<console-handler name="CONSOLE">
				<formatter>
					<named-formatter name="SNOWFLAKE-PATTERN"/>
				</formatter>
			</console-handler>
			<periodic-rotating-file-handler name="FILE" autoflush="true">
				<formatter>
					<named-formatter name="PATTERN"/>
				</formatter>
				<file relative-to="jboss.server.log.dir" path="server.log"/>
				<suffix value=".yyyy-MM-dd"/>
				<append value="true"/>
			</periodic-rotating-file-handler>
			
			<periodic-rotating-file-handler name="REQUEST-SQL-FILE" autoflush="true">
				<formatter>
					<named-formatter name="SNOWFLAKE-PATTERN"/>
				</formatter>
				<file relative-to="jboss.server.log.dir" path="go-publisher-sql.log"/>
				<suffix value=".yyyy-MM-dd"/>
				<append value="true"/>
			</periodic-rotating-file-handler>
			
			<logger category="com.arjuna">
				<level name="WARN"/>
			</logger>
			<logger category="org.apache.tomcat.util.modeler">
				<level name="WARN"/>
			</logger>
			<logger category="org.jboss.as.config">
				<level name="INFO"/>
			</logger>
			<logger category="sun.rmi">
				<level name="WARN"/>
			</logger>
			<logger category="jacorb">
				<level name="WARN"/>
			</logger>
			<logger category="jacorb.config">
				<level name="ERROR"/>
			</logger>

			<!-- This is specialist and overrides the root level -->
			<logger category="log.request">
				<level name="INFO"/>
				<handlers>
					<handler name="CONSOLE"/>
				</handlers>
			</logger>

			<!-- This is specialist and overrides the root level -->
			<logger category="log.sql">
				<level name="OFF"/>
				<handlers>
					<handler name="REQUEST-SQL-FILE"/>		
				</handlers>
			</logger>

			<logger category="org.springframework.boot.context.web.ErrorPageFilter">
				<level name="OFF"/>
			</logger>

			<logger category="uk.co.snowflakesoft.translate.schema.SchemaLocationModel">
				<level name="ERROR"/>
			</logger>
			<logger category="uk.co.snowflakesoft.translate.projectdoc.XMLMapping">
				<level name="ERROR"/>
			</logger>

			<!-- Set level to 'debug' if you want to log stack traces of all occurring 
				exceptions (including HTTP 4xx code Exceptions). -->	
			<!-- Used as the main logging level volume controller, since the root 
				logger can get very loud when logging level is increased. -->
			<logger category="uk.co.snowflakesoft.publisher">
				<level name="INFO"/>
			</logger>
			<!-- Reduce Spring Framework logging, especially at startup. -->
			<logger category="org.springframework">
				<level name="WARN"/>
			</logger>
			<!-- Reduce Hibernate logging, especially at startup. -->
			<logger category="org.hibernate">
				<!-- <level name="WARN"/> -->
				<level name="OFF"/>
			</logger>
			<!-- There is a known issue regarding Hibernate table creation, which can be ignored for now. -->
			<logger category="org.hibernate.tool.hbm2ddl.SchemaUpdate">
				<level name="OFF"/>
			</logger>

			<!-- The root logger to control the overall logging level -->
			<root-logger>
				<level name="INFO"/>
				<handlers>
					<handler name="CONSOLE"/>
				</handlers>
			</root-logger>

			<formatter name="PATTERN">
				<pattern-formatter
					pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
			</formatter>
			<formatter name="COLOR-PATTERN">
				<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
			</formatter>
			<formatter name="SNOWFLAKE-PATTERN">
				<!-- <pattern-formatter pattern="%d{HH:mm:ss.SSS} [%t] %-5p %c{36} - %m%n"/> -->
				<pattern-formatter pattern="%d{HH:mm:ss} %-5p %c{36} - %m%n"/>
			</formatter>
		</subsystem>

What logging level do I need?

The default logging level is set to "Debug", which provides you with errors, warnings and information as well as debug logging.

If you wish to edit the logging level you can do so by opening the logback.xml file in a text editor and edit the appropriate logger section, changing the logging level.

What is the difference between each log level?

Logging LevelLogging Results*
ErrorYou get only error messages for deployed applications.
WarnYou get warning logs for any unusual behaviour of deployed applications.
Info (default)The default logging level for the root of the application server: you get all the messages for regular operations.
DebugYou get the full debug logging (there are a lot of logs under this level)
TraceYou get detailed information of certain operations

Full documentation on how to configure the above WildFly 10 logging configuration can be found on the following page of the WildFly 10 documentation:

https://docs.jboss.org/author/display/WFLY10/Logging+Configuration

 Logging in Weblogic 12.2.1

 WebLogic 12.2.1

The logback.xml file will be deployed on your application server in the same location as your deployed classpath-resources so it is important you have the correct directory structure in place before deploying the logback.xml file.

The logback.xml file is utilised by the application server and therefore any other applications deployed will use the logging configurations specified.

Logback resource

 The go-publish-workflow-example-resources.zip contains a logback.xml file as part of the default resources for you to use if required:

[go-publisher-workflow-example-resources]
	|
	--[classpath-resources]
	|
	--[jboss7-module]
	|
	--logback.xml
	|
	--[workflow-schemas]
	|
	--my-product.zip

We will refer to the classpath-resources folder as the {workflowdirectory} from this point forward:

C:\classpath-resources\

Configure Logback.xml

The logback.xml file provided in the {workflowdirectory} specifies the GO Publisher Workflow related loggers.

The logback.xml file is configurable and users can change the level of logging as required by editing the logback.xml file and setting the level for the appropriate logger.

How do I add or remove loggers?

Comment and uncomment various loggers inthe logback.xml file, to remove or add more logging as required.

What logging level do I need?

The default logging level is set to "Debug", which provides you with errors, warnings and information as well as debug logging.

If you wish to edit the logging level you can do so by opening the Logback.xml file in a text editor and edit the appropriate logger section, changing the logging level.

What is the difference between each log level?

Logging LevelLogging Results*
ErrorYou get only error messages for deployed applications.
WarnYou get warning logs for any unusual behavior of deployed applications.
Info (default)The default logging level for the root of the application server: you get all the messages for regular operations.
DebugYou get the full debug logging (there are alot of logs under this level)
TraceYou get detailed information of certain operations

*As you move down the table you receive logs for the current level as well as for the levels above it. For example, if you select Warn, then you will receive errors, and warnings.

Where should I deploy the logback.xml file?

Save your logback.xml file to the 'main' folder, in the directory structure that you created when you configured GO Publisher Workflow classpath-resources:

This is the same location as the deployed gopublisher folder and gopublisher.xml file in the {workflowdirectory} on your application server:

logback.xml
|
gopublisher.xml
|
gopublisher/

Weblogic 12c (12.2.1):

DOMAIN_HOME directory
Linux e.g. /opt/oracle/middleware12c/user_projects/domains/[servername]/gopublisher

Where are log files created?

By Default logging is displayed on the workflow console only.

Logback.xml content example:

<!-- log events are displayed to System.out -->
	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
		</encoder>
	</appender>

You can use a File Appender, or Rolling File Appender to save the logs to a file directory location of your choice.

Using a File Appender

The FileAppender will put all log events into the file specified via the <file> element - This is currently set to a file called go-publisher-workflow.log within the user home directory but can be changed as appropriate.

Logback.xml content example:

	<!-- Enable logging events to a single file -->
	<!-- <appender name="FILE" class="ch.qos.logback.core.FileAppender">
		<file>${user.home}/go-publisher-workflow.log</file>
		<append>true</append>
		<encoder>
			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
		</encoder>
	</appender> -->

Using a Rolling File Appender

The RollingFileAppender is similar to the FileAppender but with the option for the log files to be 'rolled over' based on a policy.

The logback.xml file contains a RollingFileAppender example that will roll over on a daily basis. That is, at midnight go-publisher-workflow.log is renamed to go-publisher-workflow-2013-06-19.log and any subsequent logging events will go into a newly created go-publisher-workflow.log file.

Logback.xml content example:

	<!-- Enable logging events to a file that rolls over daily -->
	<!-- <appender name="ROLLINGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/go-publisher-workflow.log</file>
		<append>true</append>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			--><!-- daily rollover --><!--
			<fileNamePattern>${user.home}/go-publisher-workflow-%d{yyyy-MM-dd}.log</fileNamePattern>
			--><!-- keep 10 days' worth of history --><!--
			<maxHistory>10</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
		</encoder>
	</appender> -->

Appender Path Separators:

If you are using the appenders on a windows machine, then you can either use forward slashes as the path separator or double backslashes. For example:
C:/temp/go-publisher-workflow.log or
C:\\temp\\go-publisher-workflow.log.

Remember!

If you uncomment either the FileAppender or RollingFileAppender then remember to uncomment the appropriate <appender-ref> in the <root> logger.

Logback.xml content example:

 

	<root level="info">
		<appender-ref ref="STDOUT" />
		<!-- Uncomment if logging to a single file is enabled -->
		<!-- <appender-ref ref="FILE" /> -->
		<!-- Uncomment if logging to a file that rolls over daily is enabled -->
		<!-- <appender-ref ref="ROLLINGFILE" /> -->
	</root>

 

Catch Individual Event Logs

You can enable specific <logger> elements and have them only log their events using a specific appender. This can be seen with the log.sql logger within the attached file.
Logback.xml content example:
	<!-- Uncomment if you want the SQL statements being logged -->
	<!-- <logger name="log.sql" level="debug">
		<appender-ref ref="FILE" /> -->
		<!-- Uncomment if you want the logging events displayed to the console as well --><!--
		<appender-ref ref="STDOUT" /> --><!--
	</logger> -->

Server Logs

Best Practice is to use the above logback.xml file to control logging on your application server. However, the server log files (across all the application servers we support) contain GO Publisher Workflow logs.

 

Further Reading

Now you have deployed your configured example resources you are ready to Deploy go-publisher-workflow.war file on your application server.

For further information on how to extend the logback file, please visit http://logback.qos.ch/manual/appenders.html

  • No labels