You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nlog-...@googlegroups.com
Firstly, I'm new to NLog so forgive my use of inaccurate terminology.
I have an application that I would like the user to select the level of logging produced and whether it is to a file or not.
The easy way is to edit the NLOG.config XML file but the user doesn't have that level of knowledge. I would like to user to be able to select the level of logging displayed and whether the log is written to file or not form within the application. This suggest I need to enable/disable a target and modify the logging rules based on some user-selected variables.
I'm not sure of the most appropriate way to achieve this. My code is littered with Log.<loglevel>("Message") so it would seem that if I could programatically set the "minlevel" property of each rule I might achieve what I want, but is that the correct approach (and how do I do that?).
It seems I could also write a "proxy" and check my user preference before executing the Log.<loglevel> call, but that would involve eidting all my code to include calls to my new proxy. Is that a preferred method?
Regards Gavin.
Kim Christensen
unread,
Aug 13, 2013, 8:35:58 AM8/13/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
But in this case I would say it is better to create a proxy, controlling the behaviour.
Gavin Hill
unread,
Aug 13, 2013, 9:32:19 AM8/13/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nlog-...@googlegroups.com
Thanks for the advice Kim. I'm able to change the log level now, but adding/removing targets is proving challenging. I'm surprised there isn't more native functionality like this built into NLog given most developers desire to have users enable/disable logging to troubleshoot problems in the field.