Thanks for you reply. I tried your code below but I got an error saying that the
LogService I got from getInstance() needs to be initialized. However, the init() call
for LogService takes in an argument of a file. What should I do in this case?
Will
> Here is an example of code :
>
> import org.apache.cactus.util.log.*;
>
> public class MyTestCase extends ServletTestCase
> {
> private Log logger =
> LogService.getInstance().getLog(MyTestCase.class.getName());
> [...]
> public void testXXX()
> {
> logger.debug("something");
> }
> }
>
> In this example, we've used the class name as the Log4j Category, so we need
> to add this category to the Log4J configuration. You should either edit the
> log_server.properties file in cactus.jar and add :
>
> # Properties for configuring Log4j
> # This is the configuring for logging on the server side
>
> log4j.appender.cactus = org.apache.log4j.FileAppender
> log4j.appender.cactus.File = cactus_server.log
> log4j.appender.cactus.Append = false
> log4j.appender.cactus.layout = org.apache.log4j.PatternLayout
> log4j.appender.cactus.layout.ConversionPattern = %d{ABSOLUTE} [%t] %-5p
> %-30.30c{2} %x - %m %n
>
> log4j.category.org.apache.cactus = DEBUG, cactus
> log4j.category.my.package = DEBUG, cactus
>
> You can add an appender if you wish to have your logs generated in a
> separate file.
> The other option is not to touch at the cactus jar, create a
> log_server.properties file and ensure it is put in the classpath *before*
> the cactus.jar
>
> -Vincent
>
>
>
--
William Lee (Will) | Sendmail Inc.
Email: [EMAIL PROTECTED] | http://www.sendmail.com
Tel: (510) 594-5505 |