0

NVelocity seems to be creating a nvelocity.log in the root or our website. Apparently it is using log4net, but it is not using our current log4net configuration because our logs are in another folder.

How can we change the location of the nvelocity.log file?

Dzyann
  • 5,062
  • 11
  • 63
  • 95
  • Here's the source: https://github.com/castleproject/MonoRail/tree/master/MR2/NVelocity/src/NVelocity/Runtime/Log –  Sep 28 '16 at 21:15
  • Thanks @Amy, it was helpful to see the structure of logging files – Dzyann Sep 29 '16 at 15:33

1 Answers1

0

After some research, I found that nvelocity is being initialized using the SimpleLog4NetLogSystem, the existing configuration (this is an old feature on the site) is telling nvelocity to use the NullLogSystem. I think that's why the file is created empty and never modified, SimpleLog4NetLogSystem is used at first but then the NullLogSystem. I think it is some bug on this version.

Anyway I found how to change the configuration file, at least in the version we are using (1.0.3324.33234):

var props = new ExtendedProperties();               
props.AddProperty("runtime.log", "Logs\\nvelocity.log");

Velocity.Init(props);

In later versions "runtime.log" is specified by the NVelocity.Runtime.RuntimeConstants.RUNTIME_LOG constant.

Also the Velocity.Init can receive a configuration file so you don't have to hardcode the name of the log file.

Dzyann
  • 5,062
  • 11
  • 63
  • 95