Win a copy of Terraform in Action this week in the Cloud forum!

David Kincade

Greenhorn
+ Follow
since Nov 10, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Kincade

I am trying to log messages using log4j to multiple log files. I am using the following configuration below ...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration debug="false">

<appender name="YOURFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="log/your.log"/>
<param name="Append" value="false"/>
<param name="DatePattern" value="'.'yyyy-MM-dd-HH'.log'"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} [%5p] [%c] - %m%n"/>
</layout>
</appender>

<appender name="MYFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="log/mine.log"/>
<param name="Append" value="false"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} [%5p] [%c] - %m%n"/>
</layout>
</appender>

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} [%5p] [%c] - %m%n"/>
</layout>
</appender>

<category name="org.dmk">
<priority value="DEBUG"/>
<appender-ref ref="YOURFILE"/>
</category>

<category name="org.dmk">
<priority value="INFO"/>
<appender-ref ref="MYFILE"/>
</category>

<root>
<priority value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>

With this configuration and my sample program, I received the following output in the console:

10:44:19,834 [ INFO] [org.dmk.test.logging.sub1.Sub1] - Creating a Sub1...
10:44:19,835 [ INFO] [org.dmk.test.logging.sub2.Sub2] - Creating a Sub2 instance...
10:44:19,835 [DEBUG] [org.dmk.test.logging.sub1.Sub1] - sub1 doing DEBUG logging...
10:44:19,836 [ INFO] [org.dmk.test.logging.sub1.Sub1] - sub1 doing INFO logging...
10:44:19,836 [ WARN] [org.dmk.test.logging.sub1.Sub1] - sub1 doing WARN logging...
10:44:19,836 [ERROR] [org.dmk.test.logging.sub1.Sub1] - sub1 doing ERROR logging...
10:44:19,836 [FATAL] [org.dmk.test.logging.sub1.Sub1] - sub1 doing FATAL logging...
10:44:19,837 [DEBUG] [org.dmk.test.logging.sub2.Sub2] - sub2 doing DEBUG logging...
10:44:19,837 [ INFO] [org.dmk.test.logging.sub2.Sub2] - sub2 doing INFO logging...
10:44:19,838 [ WARN] [org.dmk.test.logging.sub2.Sub2] - sub2 doing WARN logging...
10:44:19,838 [ERROR] [org.dmk.test.logging.sub2.Sub2] - sub2 doing ERROR logging...
10:44:19,838 [FATAL] [org.dmk.test.logging.sub2.Sub2] - sub2 doing FATAL logging...

BUT, if I look at the log files generated, I get everything correctly in mine.log and NOTHING in your.log.

If I swap the order of the category tags in the XML file, I get everything correct in your.log and nothing in mine.log.

I am assuming that this means you can only have one appender assigned to a name (and the latter overrides this).

Is there a way that anyone knows of to be able to set different priorities for different appenders for the same name?

Thanks in advance,
David
Here is maybe a better way to ask my question ...

I have 2 EARs running on one JBoss server. Inside each EAR is a WAR ... and that WAR uses log4j. However, the log setting (log4j.xml) is different for each EAR.

How can I create 2 log4j.xml files and put them in 2 different places and tell each EAR where the proper log4j.xml file is located?

Thanks in advace
15 years ago
I'm not sure that the topic of that link is what I am looking for. It appears that the link is talking about how to set system properties for JBoss (or properties that will be available to all applications running on that JBoss server).

I am looking for a way that my application (and preferably ONLY my application) running on a JBoss server will have access to a properties file. In addition, I don't want to have to specify the location of the properties file in my source code ... it should be found as part of the classpath (but not contained in the EAR / WAR / JAR).

Any ideas?
15 years ago
I am moving an application from WebSphere to JBoss. Not being familiar with the SA tasks of JBoss, I have hit a question (and can't seem to find the answer on the net)...

I have a properties file that is located in the classpath of the application. This properties file must exist outside of the EAR since it contains different values on different servers (dev, test, prod).

How do I configure the deployment of the EAR to add a directory (which would contain the properties file) to add it to the application's classpath?

In WebSphere 5, it used the concept of a Shared Library (which would contain the directory name) and this was added to the application (and therefore part of the application's classpath).

Thanks in advance!
15 years ago
I am trying to use Axis to turn a Java Class into a webservice. However, one of the methods in my java class accepts a java class found in a jar file. This causes Axis to throw a ClassNotFoundException when I run the ant task <Axis-java2wsdl>

Example: If I try to turn the folloing class into a webservice using axis' ant task <Axis-java2wsdl>, I will get a ClassNotFoundException on class com.this.that.Sample (even though I have put this jar in the classpath)

MyWebService.java
...
import com.this.that.Sample; // found in jar file sample.jar

public class MyWebService {
public static int foo(Sample sample) {
...
}
}
15 years ago
I should have been more clear on my initial post (sorry for the lack of details).

I am using WSAD 5.1.2 and I am using the wizard to create a Web service Client to consume an external web service. When this is done, it drops axis.jar (version 1.0) in the project along with log4j-2.1.6.jar.

I would like to have it use the axis 1.1 jar to create the client stubs and, if possible, the log4j-2.1.8.jar at a minimuim.

So I think the reply to my initial message describes the web service deployment side ... and it still may not be possible to change how the client stubs are generated ... but I wanted to double check.

Thanks.
16 years ago
I would like to change the version of Axis that WSAD 5.1.2 uses from 1.0 to 1.1 or higher. Is that possible (and how)?

Thanks in advance
16 years ago