SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Dec 09, 2019 5:06 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Using NLog in OpenQuant
PostPosted: Tue May 24, 2011 10:40 am 
Offline

Joined: Wed Sep 26, 2007 10:03 pm
Posts: 100
Hi

I am trying to use NLog (http://nlog-project.org) within OpenQuant to produce various log messages sent to different targets (file, console, growl, etc.). In order to use it you need to reference NLog.dll in in your VS project and to copy the NLog.config file to the folder where the executable of the VS project/application is stored.

Wiki of NLog is saying following:

Quote:
NLog attempts to automatically configure itself on startup, by looking for the configuration files in some standard places.

The following locations will be searched when executing a stand-alone *.exe application:

standard application configuration file (usually applicationname.exe.config)
applicationname.exe.nlog in application’s directory
NLog.config in application’s directory
NLog.dll.nlog in a directory where NLog.dll is located
file name pointed by the NLOG_GLOBAL_CONFIG_FILE environment variable (if defined, NLog 1.0 only - support removed in NLog 2.0)

In case of an ASP.NET application, the following files are searched:

standard web application file web.config
web.nlog located in the same directory as web.config
NLog.config in application’s directory
NLog.dll.nlog in a directory where NLog.dll is located
file name pointed by the NLOG_GLOBAL_CONFIG_FILE environment variable (if defined, NLog 1.0 only - support removed in NLog 2.0)

The .NET Compact Framework doesn’t recognize application configuration files (*.exe.config) nor environmental variables, so NLog only looks in these locations:

applicationname.exe.nlog in application’s directory
NLog.config in application’s directory
NLog.dll.nlog in a directory where NLog.dll is located


I stored my NLog.config file in different locations: /SmartQuant Ltd./OpenQuant/ (where OpenQuant.exe is stored), /SmartQuant Ltd./OpenQuant/Bin, /SmartQuant Ltd./OpenQuant/Framework/bin but it didn't work. I do not have a break in the code nor an error message. The logs are just not created. The NLog.dll is stored in /SmartQuant Ltd./OpenQuant/Bin and referenced in OpenQuant.

Does anyone has used NLog within OQ? Do you have an idea where I need to save the NLog.config file?

Many thanks,
Boris


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 4:44 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
Hi,

We use the Nlog with SQ. There should be no problem at all. Make sure your Nlog.dll and Nlog.config are in the main folder i.e. C:\program files\SmartQuant ltd\OpenQuant

Just make sure your location for log files is not protected. Try to put it first in something like C:\tmp. Sometimes you may have problems accessing such places as Program Files.

Good luck.
ed


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 4:51 pm 
Offline

Joined: Wed Sep 26, 2007 10:03 pm
Posts: 100
Thanks for replying.

In the meantime I resolved the problem and it works now also for me (cannot remember what I did wrong :roll: )

Regards,
Boris


Top
 Profile  
 
PostPosted: Fri Jun 17, 2011 5:31 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 362
ochen' rad :)

Happy trading
Ed


Top
 Profile  
 
PostPosted: Tue Feb 26, 2019 12:05 pm 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
Hi,

Which target (https://nlog-project.org/config/?tab=targets) should I use in config file if I would like log information printed in OQ 2014 GUI Output window?

I tried "Console" and "Debugger", but not working.

Code:
<target name="debugger" xsi:type="Debugger" layout="${logger}::${message}"/>

Code:
<target xsi:type="Console"
            name="console"
            layout="${longdate}${level}${message} "
            encoding="UTF-8"
            error="false"
            detectConsoleAvailable="true" />


Meanwhile, the file target works well.

BTW, I also tried log4net. It will print all logs (everything from Debug to Fatal) to Output window, no matter how the min level configured. (But Console does work in log4net) Does anyone have the same issue?

Thanks.

edwardgonen wrote:
ochen' rad :)

Happy trading
Ed


Top
 Profile  
 
PostPosted: Tue Feb 26, 2019 12:23 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
ericwang wrote:
Hi,

Which target (https://nlog-project.org/config/?tab=targets) should I use in config file if I would like log information printed in OQ 2014 GUI Output window?

We have built-in writer. It can be enabled in configuration:
IsOutputLogEnabled = true
OutputLogFileName = your path


Top
 Profile  
 
PostPosted: Wed Feb 27, 2019 4:35 pm 
Offline

Joined: Thu Feb 05, 2015 11:15 am
Posts: 39
Thank you for your reply.

Does built-in writer or output console support log level routing (as an alternative of log4net or Nlog)?

skuvv wrote:
ericwang wrote:
Hi,

Which target (https://nlog-project.org/config/?tab=targets) should I use in config file if I would like log information printed in OQ 2014 GUI Output window?

We have built-in writer. It can be enabled in configuration:
IsOutputLogEnabled = true
OutputLogFileName = your path


Top
 Profile  
 
PostPosted: Thu Feb 28, 2019 9:47 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
ericwang wrote:
Thank you for your reply.

Does built-in writer or output console support log level routing (as an alternative of log4net or Nlog)?


No, it writes all messages from console output.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group