I have recently configured log4j for our web applications deployed in weblogic 10.3 domain. The steps are given below:
1. Copy log4j-1.2.9.jar & wllog4j.jar under domain_root/lib folder.
2. Create log4j.xml and drop it under domain_root folder. If you have log4j.xml inside the application(EAR/WAR), I would recommend to move outside EAR/WAR as changing severity (log level) would require re-deployment. To avoid this, we can move log4j.xml into domain root folder but again the server needs to be bounced. But there is a fix. Click here for more info.
3. Login to weblogic server console. Go to Servers -> Admin Server-> Logging. Click on advanced mode. Change the logging implementation from JDK to Log4J. Click save.
4. Activate changes. Re-start the admin server.
This should enable log4j and should write logging into log file mentioned in log4j.xml or properties file.
Hang on! There is a catch here. Say now I want to change the log level from DEBUG into WARN or ERROR. How do i do? We go to log4j.xml and change the level. Now how does this change take into effect? It needs bouncing of the server. That part i didn't like it. But guess what I have a solution for this. Please click here for changing the log levels on the fly at run time. Log4jAdmin.jsp will do the trick.
Some of our readers asked for example of log4j.xml. If you google it you will get plenty of them, still I am honoring your requests. Here you go, folks:
log4j.xml:
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d [%t] %-5p %c - %m%n"/>
</layout>
</appender>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/log/myApp.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %t %-5p %c{2} - %m%n"/>
</layout>
</appender>
<logger name="org.apache">
<level value="WARN"/>
</logger>
<logger name="org.springframework">
<level value="WARN"/>
</logger>
<root>
<level value="DEBUG"/>
<appender-ref ref="FILE"/>
<!-- <appender-ref ref="CONSOLE"/> -->
</root>
</log4j:configuration>
I have disabled log4j to write into weblogic console by commenting out. If you want to enable it just uncomment it and bounce the server, you are done!
Subscribe to:
Post Comments (Atom)
It would be nice, if i could see a example of a log4j.xml file.
ReplyDeletethanks,
ameo
Ameo,
ReplyDeleteI have added log4j.xml above. Hope it helps.
good luck.
Hi,
ReplyDeleteI wass able to generate the custom log4j logs but still it the adminserver.logs get generated using the default jdk. How can we replace those using log4j?
Thanks,
Mukul
Hi,
ReplyDeleteI followed your post to configure log4j. Somehow weblogic doesnot seem to pick up log4j.xml from the domain directory. What could be the reason?
Hello
ReplyDeleteFollowing error is coming on the console for Log4 configuration Weblogic 10.3.2.0
please repky if any solution is available
Kannan,
ReplyDeleteGreat blog, thanks.
Hi,
ReplyDeleteSay I have 3 different applications and each application is having different .log files. These applications are generating corresponding .log files correctly in weblogic9 but this is not working in weblogic10.3
Do you have any solutions how to fix this problem. All 3 applications are writing into one .log file. The first application which is deployed in weblogic10.3
Thanks,
Sharath.
Extremely badass little app. Very awesome.
ReplyDeleteThank you very much, Ananth.
~Sayan
tetqre
ReplyDeleteHI, I followed your steps but i found class not found exception and exception in main class.
ReplyDeleteplz tell me the solutions.urgently needed.
I was trying this for 10.3.3, but found out that this approach doesn't work in that version. They have provided a fix for this with the following tags placed in the weblogic.xml
ReplyDeleteEx: to force weblogic to use log4j instead of default jdk logging
org.apache.log4j.*
Just posting so that it might help some 10.3.3 folks who might have been stuck on this issue, like me for 2 days :).
sorry, the tags didn't show up...
ReplyDeletecontainer-descriptor
prefer-application-packages
org.apace.log4j.*
/prefer-application-packages
/container-descriptor
Hi,
ReplyDeletehow should the tags descriptor be ?
I have:
org.apace.log4j.*
What should be wrote before "org.apace.log4j.*" ?
Could you please post a working example of the tags that should be added ?
Thanks,
Sergio.
Thank you very much!
ReplyDeleteExcellent JSP!!!
can you please let me know how can i test this once i configured log4j
ReplyDeleteI want to filter out all the SocketException which I get in the application in to a different log file. Is it possible to handle this in configuration level rather than going and making change in code. I am using Weblogic 10.3 server.
ReplyDeleteHey there! My spouse and I frequently write guest articles or blog
ReplyDeleteposts for other site
owners to help gain publicity to our work, as
well as provide
good content to blog owners. It's a win win situation! If you
are interested feel free to email me at: abbiebaumgartner@gmail.com so
we may communicate further. Thanks!!
My blog post; Click here
Hmm it appears like your blog ate my first comment (it was extremely long) so I guess I'll just sum it up what I submitted and say, I'm thoroughly enjoying your blog.
ReplyDeleteI too am an aspiring blog writer but I'm still new to the whole thing. Do you have any suggestions for novice blog writers? I'd certainly
appreciate it.
Also visit my web page: diet plans for women to lose weight fast
I think thе admin of this web ѕite is genuinely working hаrd іn fаvοr of his
ReplyDeletesite, sіnce here evеry datа is quаlitу bаsed material.
Μy page; chatroulette
Thankѕ for уоur marvelous poѕtіng!
ReplyDeleteΙ quite enjoyеd reading іt, уou can be a gгеat author.
ӏ will bе surе tо bookmаrk
your blоg аnԁ will come baсk from noω
on. I want to encourage уou contіnue
уouг grеаt work, have a nice day!
Feеl fгee to vіsit mу ωеb
site :: chatroullette
I wаs reсommended this webѕite by ωay of my cousin.
ReplyDeleteI am nο lоnger ceгtain whether οr not this post is ωrіtten by means of him аs nobody else understаnd such
speсial about mу trοuble.
You're incredible! Thank you!
Feel free to visit my homepage: Innere HäMorrhoiden
Hello, I believe your website might be having browser compatibility problems.
ReplyDeleteWhen I take a look at your web site in Safari, it looks fine however when opening in I.
E., it's got some overlapping issues. I just wanted to provide you with a quick heads up! Aside from that, excellent website!
My web site :: affiliate Marketing Training Sought
Pretty nice post. I just stumbled upon your blog and wanted to
ReplyDeletemention that I've truly enjoyed surfing around your blog posts. After all I'll be subscribing on your feed and
I am hoping you write once more soon!
Also visit my site ... Vestal Watches
Have you ever thought about creating an e-book or guest authoring on other
ReplyDeletewebsites? I have a blog based on the same ideas you discuss and would really
like to have you share some stories/information.
I know my audience would appreciate your work.
If you are even remotely interested, feel free to shoot me an e mail.
Look at my web blog: vestal watches for men
Hi, after reading this amazing post i am also cheerful to share my knowledge here with mates.
ReplyDeletemy blog: relic watches for women
Hey! Would you mind if I share your blog with my
ReplyDeletemyspace group? There's a lot of people that I think would really appreciate your content. Please let me know. Thank you
my weblog: mens watch brands
Yеstеrdаy, whilе I was аt ωoгk, my
ReplyDeletesiѕter ѕtοle my iphonе and tеsted to see if it can survive a
thirty foot dгoр, just so she can
be a уοutubе sеnsatіon. My аpple ipad is now broken and she has 83 views.
I knοw this is еntirely off tοpiс but I hаd to share it with someone!
my blog :: Hämorrhoiden
Veгy good blog you have hеre but I wаs wantіng tο κnow if you knew of any user ԁiscussіon foгums that covег thе same toрics discussed in this аrticle?
ReplyDeleteІ'd really like to be a part of community where I can get feed-back from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Many thanks!
Look into my weblog - http://cellulitee.de
I visited several websites however the audio quality for audio songs existing at this web site is really marvelous.
ReplyDeletemy website :: travel
These loans, frequently best-better-celebrated as pay day loans, abbreviated defrayment term that spans
ReplyDeleteover a time period of time of 14-30 days.
You can meet your recognition proof is followed,
pledging safety against the investor is also not required.
One explanation power be to preclude losing a home because to
give back and thus outcome in different problems for
debtors. The amount of money subordinate this advance,
lenders countenance for you are coating fiscal occasion
precise. Normal 0 Style bank business relationship in any bank of UK.
These loans put you at an fundamental quantity of 14 to 31 days.
payday loansThe investor will okay the
dodging in few proceedings if you they are blessed with their next cash.
And for this purpose, the lenders have to be sure that You are higher up 18 nonmoving series financial gain of not less than 1,
000.
Hence, group having bad approval problems
ReplyDeletelike insolvency, late your shortened term face-to-face cash necessarily inside due time.
Same day day loans are just clean to is very unsafe. This plan of attack loan is surprisingly all-all crucial be
$50 for a $200 loan. You will be sanctioned for the cash for a very do not
ask borrowers recognition substantiation. Reason trailing of it is truncated
than other cash in your pouch. So, at that place is and subject it to the investor you are
transaction with. Taking a untroubled loan is an self-confidence of a
less rate and you can give back the monetary system at the day very easy.
pay day loansIrrespective of your good
or bad approval records, you have with an farthest fiscal answer to help you out of unheralded exigencies.
For you to measure up for these loans, it is important he would be able to make written record with botanist in an easier style in the forthcoming.
I do accept as true with all of the ideas you've presented in your post. They are very convincing and will definitely work. Nonetheless, the posts are too brief for beginners. May you please prolong them a bit from subsequent time? Thank you for the post.
ReplyDeletemy web-site; vakantiewoningen frankrijk
Hi there I am ѕо delighteԁ I found your wеbρagе,
ReplyDeleteI really fоund you by mistake, whilе I ωаs broωsing on Υahоo fоr ѕomethіng elsе,
Nonethеleѕs I am heгe nοω аnd would јust likе to sаy thаnκѕ for a remаrkаble
post and a all гound enϳoyаblе blοg (I
also love thе theme/dеsign), I don't have time to browse it all at the minute but I have book-marked it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the superb work.
Have a look at my web-site :: Bauchmuskeltraining
Hello There. I fоund your blog using mѕn.
ReplyDeleteThis is an extгemely well ωritten аrtiсle.
I'll be sure to bookmark it and return to read more of your useful info. Thanks for the post. I will definitely return.
my webpage; häMorrhoiden
It's actually a great and helpful piece of info. I'm satisfied that you
ReplyDeletejust shared this helpful info with us. Please stay us up to date like this.
Thanks for sharing.
Also visit my web page; best gps systems
Hi there, I do think your site might be having browser compatibility problems.
ReplyDeleteWhenever I look at your website in Safari, it looks fine however,
if opening in I.E., it's got some overlapping issues. I just wanted to provide you with a quick heads up! Besides that, great site!
Feel free to visit my web blog best golf gps
Hаving read this I believеd it ωas very informative.
ReplyDeleteI aрpreciаte you fіnding the time and energу to
put this informative аrticle together.
I οnce agaіn find myself persοnally spending a sіgnifіcant amount of tіme both rеading and leaving commеnts.
But so what, it was still worthwhile!
Here is my homepage ... BauchmuskelüBungen
Τhanks for one's marvelous posting! I quite enjoyed reading it, you might be a great author. I will be sure to bookmark your blog and definitely will come back at some point. I want to encourage yourself to continue your great posts, have a nice holiday weekend!
ReplyDeleteHere is my webpage: Cellulite
I'm extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the excellent quality writing, it's rare to see a grеаt blog lіkе thiѕ one nowadays.
ReplyDeleteAlso viѕit my web page - Stop HéMorroïDes
Hi, i feel that i notiсeԁ you visited my blog so i got heгe to return thе favor?
ReplyDelete.I'm attempting to find issues to improve my web site!I guess its ok to use a few of your ideas!!
my homepage; les hémorroïdes
Ӏ lіke what you guyѕ are uѕually up too.
ReplyDeleteThiѕ kind of cleveг worκ and coverage!
Κeеp up the good woгks guys I've you guys to my blogroll.
Feel free to surf to my weblog :: Sixpack - -
I think there is a missed step that is to configure env. variable LOG4J_CONFIG_FILE
ReplyDeleteRegards
Configuring log4j for your Java Application for Web Logic 10.3.6.0
ReplyDeleteServer side Configurations
1. Copy wllog4j.jar from your WebLogic server/lib directory and place it in your domain_root/lib folder. –
example : /u01/oracle/Oracle/Middleware/user_projects/domains/gl_domain/lib
2. Copy your version of log4j.jar to your domain_root/lib folder.
example : /u01/oracle/Oracle/Middleware/user_projects/domains/gl_domain/lib
We used log4j-1.2.17.jar in the project
3. Copy your log4j.xml to your domain_root folder.
4.
5. (Linux)Edit the setDomainEnv.sh file in the domain_root/bin directory. and find the following code:
if [ "${LOG4J_CONFIG_FILE}" != "" ] ; then
JAVA_PROPERTIES="${JAVA_PROPERTIES} -Dlog4j.configuration=file:${LOG4J_CONFIG_FILE}"
export JAVA_PROPERTIES
fi
Insert the following above those lines of code(replacing the path with the one for your system's domain_root directory:
LOG4J_CONFIG_FILE=”/u01/app/oracle/middleware/user_projects/domains/base_domain/log4j.xml”
Export LOG4J_CONFIG_FILE
example : /u01/oracle/Oracle/Middleware/user_projects/domains/gl_domain/log4j.xml
6. Login to weblogic server console. Go to Servers -> Admin Server-> Logging. Click on advanced mode. Change the logging implementation from JDK to Log4J. Click save. (As shown in screenshots below)
7. Activate changes. Re-start the admin server.
Program level Addon
1. Place the log4j configuration file in server and provide that info in below mentioned way in Java program.
PropertyConfigurator.configure("/home/SOA_LOG_CONFIG_DIR/test_log4j.properties");
Configuring log4j for your Java Application for Web Logic 10.3.6.0
ReplyDeleteServer side Configurations
1. Copy wllog4j.jar from your WebLogic server/lib directory and place it in your domain_root/lib folder. –
example : /u01/oracle/Oracle/Middleware/user_projects/domains/gl_domain/lib
2. Copy your version of log4j.jar to your domain_root/lib folder.
example : /u01/oracle/Oracle/Middleware/user_projects/domains/gl_domain/lib
We used log4j-1.2.17.jar in the project
3. Copy your log4j.xml to your domain_root folder.
4.
5. (Linux)Edit the setDomainEnv.sh file in the domain_root/bin directory. and find the following code:
if [ "${LOG4J_CONFIG_FILE}" != "" ] ; then
JAVA_PROPERTIES="${JAVA_PROPERTIES} -Dlog4j.configuration=file:${LOG4J_CONFIG_FILE}"
export JAVA_PROPERTIES
fi
Insert the following above those lines of code(replacing the path with the one for your system's domain_root directory:
LOG4J_CONFIG_FILE=”/u01/app/oracle/middleware/user_projects/domains/base_domain/log4j.xml”
Export LOG4J_CONFIG_FILE
example : /u01/oracle/Oracle/Middleware/user_projects/domains/gl_domain/log4j.xml
6. Login to weblogic server console. Go to Servers -> Admin Server-> Logging. Click on advanced mode. Change the logging implementation from JDK to Log4J. Click save. (As shown in screenshots below)
7. Activate changes. Re-start the admin server.
Program level Addon
1. Place the log4j configuration file in server and provide that info in below mentioned way in Java program.
PropertyConfigurator.configure("/home/SOA_LOG_CONFIG_DIR/test_log4j.properties");
Hi Everyone,
ReplyDeleteWe did server level changes as mentioned here and after that some of the logging done locally within some web apps locally stopped working. Does this override any log4j configuration present within each web apps?
Our site best replica designer bags click to read more replica louis vuitton bags try these out replica designer bags
ReplyDeletei thought about this Resources hop over to here Fendi Dolabuy discover here go to this website
ReplyDeletegolden goose sale
ReplyDeleteoff white
bape outlet
kd shoes
golden goose shoes sale