Comments (4)
Here is my code in old version of syslog. Hope it helps.
var config = LogManager.Configuration;
var syslogTarget = config.FindTargetByName<Syslog>(CNSTR_SYSLOG);
syslogTarget.SyslogServer = "some.syslog.server";
LogManager.Configuration = config;
LogManager.Configuration.Reload();
LogManager.ReconfigExistingLoggers();
from nlog.targets.syslog.
I just created a console application and found out that both the ColoredConsoleTarget and FileTarget behave as expected without reloading the configuration or reconfiguring loggers:
var coloredConsoleTarget = loggingConfiguration.FindTargetByName<ColoredConsoleTarget>(ColoredConsoleTargetName);
coloredConsoleTarget.Layout = "${message}";
var fileTarget = loggingConfiguration.FindTargetByName<FileTarget>(FileTargetName);
fileTarget.FileName = ".\\new-log.txt";
This is because those targets use target properties directly instead of loading them from configuration settings.
I thought that the InitializeTarget was called to reconfigure a target, but if it is already inited no reconfig happens 😞
I could simply add a ReInitialize method but I would prefer not breaking the NLog base Target API.
Moreover I would like to avoid adding a Reinit call to each and every configuration setter.
Maybe a ForceReinit or ReconfigExistingLoggers(force: true) would be useful...
Does @304NotModified have any suggestion on the expected behavior a target with complex configuration should have and a feasible and elegant solution?
from nlog.targets.syslog.
Isn't easy to reset the cached values in the setter?
Eg in the set
of Server property, clear the current connection. IPropertyChanged is maybe a nice pattern.
from nlog.targets.syslog.
I have just implemented INotifyPropertyChanged to reinit the target.
I will try to refine the solution as soon as possible
from nlog.targets.syslog.
Related Issues (20)
- Name of wrapped target has "_wrapped" suffix HOT 3
- Infinite retries and potential log entries lost upon delivery failure HOT 2
- Delivery issues result in infinite retries HOT 1
- Delivery issues can result in lost log entries HOT 4
- UnobservedTaskException thrown on configuration reload HOT 3
- Superfluous catch of OperationCanceledException
- Support for .NET Framework not needed
- Multiple build services are used
- How to get started is missing HOT 1
- Extensions section missing in sample configuration HOT 1
- NLog version in README is wrong
- Build badges in README are not relevant
- NuGet publication fails with Powershell error
- NuGet publication unable to find packages
- Is the target compatible with the new NLog extension configuration? HOT 32
- Improper dependency handling with .NET Framework application HOT 5
- structured logging - Escaping special characters for ${all-event-properties} layout renderer HOT 1
- Syslog logging just randomly stops HOT 4
- Add support for TLS (TLS server certificate validation)
- Truncation not Working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlog.targets.syslog.