Tech-Today
How to install Logback Logger in Glassfish 3.1.1
How to install Logback Logger in Glassfish 3.1.1
1.) Download the ff jars:
a.) slf4j-api.jar
b.) jul-to-slf4j.jar
c.) logback-classic.jar
d.) logback-core.jar
2.) Copy the jars mentioned above in {glassfish_home}/glassfish/lib/endorsed.
3.) Modify domain.xml in {glassfish_home}/glassfish/domains/domain1/config/domain.xml. We assume that you did not create another domain for this exercise. Otherwise change domain1 to your desired domain.
4.) In the "java-config" section add the ff "jvm-options":
<jvm-options>-Dlog4j.configuration=file:///${com.sun.aas.instanceRoot}/config/custom_logging.properties</jvm-options>
<jvm-options>-Dlogback.configurationFile=file:///${com.sun.aas.instanceRoot}/config/logback.xml</jvm-options>
5.) The above 2 statements will configure logger and forward the logging statement to logback. custom_logging.properties
handlers = org.slf4j.bridge.SLF4JBridgeHandlercom.sun.enterprise.server.logging.GFFileHandler.flushFrequency=1
com.sun.enterprise.server.logging.GFFileHandler.file=${com.sun.aas.instanceRoot}/logs/server.log
com.sun.enterprise.server.logging.GFFileHandler.rotationTimelimitInMinutes=0
com.sun.enterprise.server.logging.GFFileHandler.logtoConsole=false
com.sun.enterprise.server.logging.GFFileHandler.rotationLimitInBytes=2000000
com.sun.enterprise.server.logging.GFFileHandler.alarms=false
com.sun.enterprise.server.logging.GFFileHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter
com.sun.enterprise.server.logging.GFFileHandler.retainErrorsStasticsForHours=0
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %5p | %t | %-55logger{55} | %m %n</pattern>
</encoder>
</appender>-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="com.ipiel">
<level value="debug" />
</logger>
<logger name="org.springframework">
<level value="debug" />
</logger>
<root>
<level value="debug" />
<appender-ref ref="console" />
</root>
</configuration>
-
How To Call A Javaee Rest Web Service With Basic Authentication Using Jquery Ajax
I don't really remember when I coded it, nor where I got it but I'm writing it here for future use :-) Below is the code I use to test CORS, http://en.wikipedia.org/wiki/Cross-origin_resource_sharing. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>...
-
How To Monitor The Data Source Connections And Sql Queries In Jboss
To allow us to debug our jboss server for possible connection leaks, wrong sql queries normally we do 2 changes: 1.) In persistence.xml, set hibernate.show_sql to true 2.) In jboss's standalone.xml, we set the hibernate logger to DEBUG <logger...
-
How To Create Size-rotating-file Handler In Jboss 7.2 Using Cli
There are times when we require a size-rotating-file handler over the default periodic-rotating-file handler. Simply changing the properties in standalone.xml won't do because it will cause synch problem with logging.properties. So to do so we need...
-
How To Enable Remote Jvm Monitoring Using Jre's Built In Jconsole
This guide will help you setup a remote jvm monitoring tool using jconsole. The setup: 1.) Ubuntu 12.04 2.) Glassfish 3.1.2.2 3.) jdk1.6.0_32 Steps: 1.) In your glassfish's default domain1 domain.xml file, /glassfish_home/glassfish/domains/domain1/config/domain.xml,...
-
How To Load Property File From Glassfish Config's Folder
In seam you can define a component class in components.xml that will load the properties from the JBOSS_CONFIG folder. Add the ff lines: <component name="paramBean" class="com.ipil.PropertyBean" scope="application" auto-create="true" startup="true">...
Tech-Today