Friday, December 20, 2013

Logtail – Weblogic Application Servers

What is Logtail and purpose of it?

Logtail is an AJAXified logfile download and tailing application. In some big development projects it helps Developers, Testers and Administrators to multiple log files on multiple machines through the use of browsers.


clip_image002

Step1: Download
Download the Logtail Web Application as WAR file from the sourceforge.net website.
http://sourceforge.net/projects/logtail/files/logtail/logtail-0.2/

Step 2: Installation(Deployment)
As this is the web application (WAR) project, we need to deploy this in some application servers like Apache Tomcat, Oracle Weblogic, Oracle Glassfish, Redhat JBoss or IBM Websphere.

Step 3: Configuration Steps
1] Deploy the logtail-0.2.war to application server; in my case I’m deploying it to the Oracle Weblogic Application Server.


clip_image004

2] Before starting the Managed Server (JVM) it’s very important to add the Logtail-configuration.xml file to the Java classpath. And finally export the JAVA_OPTIONS parameter.

JAVA_OPTIONS="-Dweblogic.security.SSL.trustedCAKeyStore="/optional/Oracle12c/Middleware/wlserver_12.1/server/lib/cacerts" -Dlogtail-config="/optional/installers/logtail-config.xml" ${JAVA_OPTIONS}"
export JAVA_OPTIONS

3] Now we need to create the Logtail-config.xml file and add the required logs to the xml file inside the <logs> <log-source> </log-source></logs> tag.

<?xml version="1.0" encoding="UTF-8"?>

<logtail>

<!--

logtail looks in all log-sources for files. You can either configure a direct file

or a directory. If you configure a directory ALL files in that directory are shown

by logtail.

-->

<logs>

<!-- Application Logs -->

<log-source>

<path>/optional/application-logs/</path>

<decorator-name>DefaultDecorator</decorator-name>

</log-source>

<!-- Weblogic Server Logs for Server server01 -->

<log-source>

<path>/optional/Oracle/Middleware/user_projects/domains/base-domain/servers/server01/logs/</path>

<decorator-name>DefaultDecorator</decorator-name>

</log-source>

</logs>

<decorators>

<decorator>

<name>DefaultDecorator</name>

<class-name>logtail.decorator.RegexDecorator</class-name>

<config>

<!--

You can highlight parts of the logfile by providing a regular expression

(see http://en.wikipedia.org/wiki/Regular_expression and

http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html

for details).

css-style must be valid CSS-styles. See http://en.selfhtml.org/ for details.

Highlighting patterns are applied from top to bottom of this list. So general

patterns should be placed at the top of this list.

-->

<!-- Highlight log4j stuff -->

<highlight>

<regexp>.*DEBUG.*</regexp>

<css-style>color: black; background-color: #EEEEEE;</css-style>

</highlight>

<highlight>

<regexp>.*INFO.*</regexp>

<css-style>color: black; background-color: #CCCCCC;</css-style>

</highlight>

<highlight>

<regexp>.*WARN.*</regexp>

<css-style>color: black; background-color: yellow;</css-style>

</highlight>

<highlight>

<regexp>.*ERROR.*</regexp>

<css-style>color: white; background-color: #DD0000;</css-style>

</highlight>

<highlight>

<regexp>.*FATAL.*</regexp>

<css-style>color: white; background-color: #FF0000;</css-style>

</highlight>

<!-- Highlight IP-addresses -->

<highlight>

<regexp>d{1,3}.d{1,3}.d{1,3}.d{1,3}</regexp>

<css-style>color: purple; background-color: #FFFFFF;</css-style>

</highlight>

<!-- Highlight everything in parentheses -->

<highlight>

<regexp>([^)]*)</regexp>

<css-style>color: green; background-color: #FFFFFF;</css-style>

</highlight>

<!-- Highlight everything in brackets -->

<highlight>

<regexp>[[^]]*]</regexp>

<css-style>color: blue; background-color: #FFFFFF;</css-style>

</highlight>

</config>

</decorator>

</decorators>

</logtail>
 
4] Once the Logtail-0.2.war is deployed and Logtail-config.xml added to the class path, we are good to start application server using the start-up script we customized
.
5] Now just open up the browser and enter the URL:
http://localhost:7005/logtail-0.2

clip_image006

 That’s it!! Now all the Developers, Testers and Administrators can access the various logs using the browsers like Chrome, Firefox or IE.

No comments:

Post a Comment