--
krishna prasad
------------------------------------------------------------------------
Posted via http://www.webservertalk.com
------------------------------------------------------------------------
View this thread: http://www.webservertalk.com/message554069.html
Use of log4j within a portlet is possible and would include requiring the
necessary log4j jars in the portlet with the configuration file. Another
alternative might be a WAS shared library.
In general, log4j was designed to be usable from any Java context. WAS
itself does not provide the jars, but
that doesn't prohibit you from doing so.
Scott
"krishna prasad" <krishna.pr...@mail.webservertalk.com> wrote in
message news:krishna.pr...@mail.webservertalk.com...
1. Place commons-logging.jar and log4j.jar in the WEB-INF/lib directory
of the portlet war file.
2. Create a text file named commons-logging.properties in the
WEB-INF/classes directory and set the LogFactory:
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
3. Create a text file named log4j.properties in the WEB-INF/classes
directory. Just follow the directions provided by the log4j docs. One
thing you can do to make life easy (assuming you're logging to a file)
is to use a built-in WebSphere variable to designate the location of the
file to be the same location as SystemOut.log, etc - like this:
log4j.appender.R.File=${SERVER_LOG_ROOT}/my_portlet.log
4. After the application is installed, ensure the Classloader Mode in
BOTH the enterprise application and the web module to PARENT_LAST. If
you don't do this, the portal logger will take over logging and your
log4j settings will have no effect.
Hi
This seemed like a neat trick so I tried this using the WSAD (5.1.2)
portal test environment, but the log file never appears in the expected
log directory. I also tried to deploy it on the company portal server
with the same result. In both cases it always gets created at the root.
So if my wsad installation is in c:\wsad then the log file gets created
in the c:\ root directory when it should have been
c:\wsad\runtimes\portal_v50\log. Can any one tell me why this is?
The SERVER_LOG_ROOT variable seems to be present in the test server
substitution variables tab unders server settings (WSAD) and points to
${WPS_HOME}/log. The WPS_HOME variable points to the correct setting (I
actually had to change it for my test environment), but still no log
file in the log directory...
I'm running on IBM WebSphere Portal 5.0.2.1. The "usual" WPS log files
(wps_YYYY.MM.DD-HH.MM.SS.log) always get created in the log directory so
that's working as normal. However, I noticed this at the top of a log file:
Installation
--------------------------------------------------------------------------------
Product Directory E:\wsad\runtimes\portal_v50
Version Directory ${product.dir}\version
DTD Directory ${version.dir}\dtd
Log Directory ${version.dir}\log
Backup Directory ${version.dir}\backup
TMP Directory C:\DOCUME~1\LEE~1.DIN\LOCALS~1\Temp
Notice the "Log Directory" value. I tried to use the value
${version.dir}\log in my log4j.properties file, but got exact same
results as before.
Can anyone see what's wrong?
Regards
Lee Francis
Scott
"Lee Francis Wilhelmsen" <le...@start.no-n-o-s-p-a-m> wrote in message
news:cp9f54$4foi$1...@news.boulder.ibm.com...
So what you're saying is that
log4j.appender.R.File=${SERVER_LOG_ROOT}/my_portlet.log
or the like won't work becuase log4j has no knowledge of WAS/WPS
shortcut paths?
Regards
Lee Francis
"Lee Francis Wilhelmsen" <le...@start.no-n-o-s-p-a-m> wrote in message
news:cpbics$55gc$1...@news.boulder.ibm.com...