-
1. Re: Jboss 7 AS and log4j.xml
prasad.deshpande Aug 23, 2011 4:27 AM (in response to dkumaran)Yes, you can have it, just put it in your application classpath & use it as like with any other application.
-
2. Re: Jboss 7 AS and log4j.xml
dkumaran Aug 24, 2011 1:13 AM (in response to prasad.deshpande)i have tried in my sample application, and configured the log File as d:/server/log/samplelog4j.log but i don't see the log file getting created, Please help me in resolving the issue. Attached the sample source project.
-
samplelog4j.zip 10.1 KB
-
-
3. Re: Jboss 7 AS and log4j.xml
prasad.deshpande Aug 24, 2011 7:32 AM (in response to dkumaran)Couple of things that I observed about your application.
1. You have added dependency in your WAR from jboss log4j by adding Dependencies: org.apache.log4j that made your war to use log4j.jar from jboss, when you do that, initialization of log4j configuration is already done (before your application loads up) when jboss starts. So even if you put log4j.xml in your classes directory, it still is not considering that file... this could be a bug (not sure whether with jboss or log4j), I'm not sure as I don't have in-depth knowledge of log4j. So to workaround I've added log4j.jar in WEB-INF/lib directory & removed Dependency: ...... from your manifest.
2. I'm not sure how to access any of your classes (SampleDao, JaxRsActivator, SampleEndpoint & SampleService) to log something into log file, but I simply created a servlet & added to your WAR to do some logging just to make log4j initialize & log something.
Have a look at attached WAR for your reference, that should get to started.
-
samplelog.war 437.7 KB
-
-
4. Re: Jboss 7 AS and log4j.xml
dkumaran Sep 6, 2011 5:46 AM (in response to prasad.deshpande)Thanks Prasad,
Your sample application was very useful and i could able to proceed with the same.
-
5. Re: Jboss 7 AS and log4j.xml
dkumaran Sep 6, 2011 5:49 AM (in response to dkumaran)My intension was to use the slf4j in the application with log4j-slf4j binder, and i could able to succeed with that combination as well...
attached the source for the same hoping that it will be used by some body else in future.
To access the REST API exposed in the application try
-
sampleslf4j.rar.zip 7.2 KB
-
-
6. Re: Jboss 7 AS and log4j.xml
hantsy Sep 6, 2011 6:12 AM (in response to dkumaran)How to use Seam 3 Logger(from Seam Solder Logging) on Jboss 7...
@Inject Logger log
I want to use log4j properties to control the output info and Seam Logger in code...but it did not work.
-
7. Re: Jboss 7 AS and log4j.xml
thinksteep Apr 4, 2012 12:25 PM (in response to prasad.deshpande)Hi Prasad,
I deployed the war you attached to Jboss7.1 final. Somehow it didn't create any log in standalong/log folder. What could be wrong? Could you please help.
Thanks for your time and help.
-
8. Re: Jboss 7 AS and log4j.xml
lukasw44 Jul 20, 2012 5:50 AM (in response to dkumaran)Can i configure logging and dont use log4j and slf4j
but only jboss logging ??? and configure it in project ?? used xml files or properties
can i do something like that in jboss as 7 :
-
9. Re: Jboss 7 AS and log4j.xml
lukasw44 Jul 24, 2012 9:57 AM (in response to lukasw44)Hello i think that it is a bug into https://docs.jboss.org/author/display/AS71/How+To#HowTo-HowdoIuselog4j.propertiesorlog4j.xmlinsteadofusingtheloggingsubsystemconfiguration%3F
they wrote :
Create a jboss-deployment-structure.xml with the following content and place it in the META-INF/ directory if you are deploying an EAR or the WEB-INF/ directory if you are deploying a WAR.
but i use this tutorial :
http://middlewaremagic.com/jboss/?p=1458
and he wrote :
NOTE: after building the WAR file make sure that the “jboss-deployment-structure.xml” is present inside the “META-INF” directory of your WAR file. Example: ${WAR_NAME}/META-INF/jboss-deployment-structure.xml
And this example working fine ?
in my project i have got jboss-deployment-structure.xml and i configure save log into file under dir " /home/user/log/myLog.log" and spend a lot of my time think what is wrong in my configuration and when i try to do it and add /jboss-deployment-structure.xml to the META-INF folder everything is fine so im very angry
summary : your jboss-deployment-structure.xml must be under META-INF in war not under WEB-INF !
-
10. Re: Jboss 7 AS and log4j.xml
zhouyaguo Aug 28, 2013 1:53 AM (in response to lukasw44)The code shows it's ok under WEB-INF/ folder.
[1]
publicstaticfinalString[]DEPLOYMENT_STRUCTURE_DESCRIPTOR_LOCATIONS={
"META-INF/jboss-deployment-structure.xml",
"WEB-INF/jboss-deployment-structure.xml"};
[2]
for(finalStringloc:DEPLOYMENT_STRUCTURE_DESCRIPTOR_LOCATIONS){
final VirtualFile file = deploymentRoot.getRoot().getChild(loc);
if (file.exists()) {
deploymentFile = file;
break;
}
}