velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barbara Baughman <baugh...@utdallas.edu>
Subject Re: Log4JLogSystem...
Date Mon, 25 Mar 2002 17:26:05 GMT
I am using Velocity 1.1-rc2 and Log4J 1.1.3.  This may or may not be
helpful, but it's before the new handling of Log4J logging. 

The velocity.properties file has:

runtime.log=/WEB-INF/logs/velocity.log
runtime.log.logsystem.class=org.apache.velocity.runtime.log.Log4JLogSystem
runtime.log.logsystem.log4j.pattern=%d - %m%n
runtime.log.logsystem.log4j.file.size=10000
runtime.log.logsystem.log4j.file.backups=1 

In the MainController (relevant code only):
import org.apache.log4j.PropertyConfigurator;

public class MainController extends VelocityServlet {
    protected Properties loadConfiguration(ServletConfig config )
            throws IOException, FileNotFoundException {
        /* get properties file and load it from web application root */
            
        String propsFile = config.getInitParameter(INIT_PROPS_KEY);
        Properties p = new Properties();
     
        if ( propsFile != null ) {
            String realPath = context.getRealPath(propsFile);
            if ( realPath != null ) {
                propsFile = realPath;
            }
            p.load( new FileInputStream(propsFile) );
            PropertyConfigurator.configure(propsFile);
        }
    }
}

Barbara Baughman
X2157

On Sat, 23 Mar 2002, bob mcwhirter wrote:

> 
> Howdy folks...
> 
> Was wondering who, if anyone, uses the Log4JLogSystem.
> 
> My application already has log4j configured, with log4j.properties doing
> the things I want it to do.  I'm attempting to use the Log4JLogSystem,
> but it seems to insist on appending its logs to its own logfile, and
> doesn't send them to my normal appender.  Plus, there seems to be no
> way of setting the Category that Velocity will use.
> 
> I'm on the verge of writing my own Log4JLogSystem to work more intuitively
> and friendly with an existing log4j system an application might already
> have.  
> 
> Any comments?  Someone want to tell me that I'm simply using velocity's
> Log4JLogSystem the WrongWay(tm)?
> 
> 	thanks,
> 
> 	-bob
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message