You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "J. B. Rainsberger" <jb...@diasparsoftware.com> on 2002/08/30 17:16:30 UTC

TDK-2.1 and logging

Hello, folks.

I am trying to register a Service with Turbine (TDK 2.1) and I'd like
to perform debug logging from within my service while I learn how to
properly write automated tests for it. :)

My log messages do not show up in turbine.log. Clearly I do not
understand how to do this. Could someone please help me out?
Explanation, example, tutorial, whatever. Thanks.

Here is what I have tried to do. Any comment is welcome.


In TurbineResources.properties:
services.LoggingService.facilities=system,debug,security
services.LoggingService.default=system
services.LoggingService.loggingConfig=org.apache.turbine.services.loggin
g.PropertiesLoggingConfig

services.LoggingService.system.destination.file=/logs/turbine.log
services.LoggingService.system.className=org.apache.turbine.services.log
ging.FileLogger
services.LoggingService.system.level=INFO


In my Service class:
    public void init(final ServletConfig config)
            throws InitializationException {

        final LoggingService loggingService = (LoggingService)
TurbineServices.getInstance().getService("LoggingService");
        final Logger logger = loggingService.getLogger("system");

        logger.debug("Beginning initialization of Prevayler
Service...");
        logger.debug("ServletConfig = " + config);
        logger.debug("Calling super.init");

        super.init(config);
        
        // For now, service parameters are in web.xml. Will move to
TR.properties at some point

        final String unableToInitializeMessage = "Unable to initialize
Prevayler Service";
        final String prevalenceFolderPath =
config.getInitParameter("prevalenceFolder");
        logger.debug("prevalenceFolderPath = " + prevalenceFolderPath);

        prevalenceFolder = new File(prevalenceFolderPath);
        logger.debug("Created prevalenceFolder.");
        try {
            final String prevalentSystemClassName =
config.getInitParameter("prevalentSystemClassName");
            logger.debug("prevalentSystemClassName = " +
prevalentSystemClassName);
            final Class prevalentSystemClass =
Class.forName(prevalentSystemClassName);
            prevalentSystem = (PrevalentSystem)
prevalentSystemClass.newInstance();
            logger.debug("Created prevalent system: " +
prevalentSystem);
        }
        catch (final ClassNotFoundException e) {
            logger.error(e);
            throw new
InitializationException(unableToInitializeMessage, e);
        }
        catch (final InstantiationException e) {
            logger.error(e);
            throw new
InitializationException(unableToInitializeMessage, e);
        }
        catch (final IllegalAccessException e) {
            logger.error(e);
            throw new
InitializationException(unableToInitializeMessage, e);
        }
    }
J. B. Rainsberger,
President, Diaspar Software Services
Let's write software that people understand.
http://www.diasparsoftware.com/
telephone: +1 416 791-8603
All correspondence (c) 2002 Diaspar Software Services.
If you want to use it, just ask; don't steal.


building a 2.2-b3 edtion

Posted by Marc Lustig <ma...@marclustig.com>.
Hi,

I'm struggling to build a Turbine 2.2 b3.
What I did is basically expanding a tdk-pre-2.2.tar.gz archive and putting
the turbine-2.2-b3.jar from turbine-2.2-b3.tar.gz archive into tdk22/lib
directory.
Is the tdk-pre-2.2.tar.gz a good basis or should I rather use the 2.1
release-build as the basis?

How do I tell Turbine not to use any of the other turbineXXX.jar files but
this turbine-2.2-b3.jar instead?

When I try to build it with ant various torque-classes can't be found in the
source-tree. Strangely I couldn't find them in the actual
torque-distribution as well.

Any idea?

Thanks!

Marc


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: TDK-2.1 and logging

Posted by "J. B. Rainsberger" <jb...@diasparsoftware.com>.
Thanks, David.

I assumed that INFO included DEBUG; I suppose that's wrong, then.

I will try this out and be back on the list if there are any problems.

Thanks for your kind words about my site. Pass it on. :)

*********** REPLY SEPARATOR  ***********

On 2002-08-30 at 16:47 David Wynter wrote:

>Hi JB,
>
>Here is my TR.Properties excerpt, provides log rolling, which is v.
nice.
<snip />

>Your level is set to INFO, not DEBUG
>
>By the way, some nice articles on your website.
>
>David
<snip />

J. B. Rainsberger,
President, Diaspar Software Services
Let's write software that people understand.
http://www.diasparsoftware.com/
telephone: +1 416 791-8603
All correspondence (c) 2002 Diaspar Software Services.
If you want to use it, just ask; don't steal.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: TDK-2.1 and logging

Posted by David Wynter <da...@btclick.com>.
Hi JB,

Here is my TR.Properties excerpt, provides log rolling, which is v. nice.

services.LoggingService.facilities=system
services.LoggingService.default=system
services.LoggingService.loggingConfig=org.apache.turbine.services.logging.Pr
opertiesLoggingConfig

# A facility for system logging.
services.LoggingService.system.destination.file=/logs/turbine.log
services.LoggingService.system.className=org.apache.turbine.services.logging
.Log4JavaLogger
services.LoggingService.system.level=DEBUG
services.LoggingService.system.file.size=1048576
services.LoggingService.system.file.backups=5

Your level is set to INFO, not DEBUG

By the way, some nice articles on your website.

David

-----Original Message-----
From: J. B. Rainsberger [mailto:jbr@diasparsoftware.com]
Sent: 30 August 2002 16:17
To: turbine-user@jakarta.apache.org
Subject: TDK-2.1 and logging


Hello, folks.

I am trying to register a Service with Turbine (TDK 2.1) and I'd like
to perform debug logging from within my service while I learn how to
properly write automated tests for it. :)

My log messages do not show up in turbine.log. Clearly I do not
understand how to do this. Could someone please help me out?
Explanation, example, tutorial, whatever. Thanks.

Here is what I have tried to do. Any comment is welcome.


In TurbineResources.properties:
services.LoggingService.facilities=system,debug,security
services.LoggingService.default=system
services.LoggingService.loggingConfig=org.apache.turbine.services.loggin
g.PropertiesLoggingConfig

services.LoggingService.system.destination.file=/logs/turbine.log
services.LoggingService.system.className=org.apache.turbine.services.log
ging.FileLogger
services.LoggingService.system.level=INFO


In my Service class:
    public void init(final ServletConfig config)
            throws InitializationException {

        final LoggingService loggingService = (LoggingService)
TurbineServices.getInstance().getService("LoggingService");
        final Logger logger = loggingService.getLogger("system");

        logger.debug("Beginning initialization of Prevayler
Service...");
        logger.debug("ServletConfig = " + config);
        logger.debug("Calling super.init");

        super.init(config);

        // For now, service parameters are in web.xml. Will move to
TR.properties at some point

        final String unableToInitializeMessage = "Unable to initialize
Prevayler Service";
        final String prevalenceFolderPath =
config.getInitParameter("prevalenceFolder");
        logger.debug("prevalenceFolderPath = " + prevalenceFolderPath);

        prevalenceFolder = new File(prevalenceFolderPath);
        logger.debug("Created prevalenceFolder.");
        try {
            final String prevalentSystemClassName =
config.getInitParameter("prevalentSystemClassName");
            logger.debug("prevalentSystemClassName = " +
prevalentSystemClassName);
            final Class prevalentSystemClass =
Class.forName(prevalentSystemClassName);
            prevalentSystem = (PrevalentSystem)
prevalentSystemClass.newInstance();
            logger.debug("Created prevalent system: " +
prevalentSystem);
        }
        catch (final ClassNotFoundException e) {
            logger.error(e);
            throw new
InitializationException(unableToInitializeMessage, e);
        }
        catch (final InstantiationException e) {
            logger.error(e);
            throw new
InitializationException(unableToInitializeMessage, e);
        }
        catch (final IllegalAccessException e) {
            logger.error(e);
            throw new
InitializationException(unableToInitializeMessage, e);
        }
    }
J. B. Rainsberger,
President, Diaspar Software Services
Let's write software that people understand.
http://www.diasparsoftware.com/
telephone: +1 416 791-8603
All correspondence (c) 2002 Diaspar Software Services.
If you want to use it, just ask; don't steal.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>