Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Configure GelfUpdAppender remote address/port at runtime #23

Closed
bledbet opened this issue Aug 26, 2016 · 2 comments
Closed

Configure GelfUpdAppender remote address/port at runtime #23

bledbet opened this issue Aug 26, 2016 · 2 comments

Comments

@bledbet
Copy link

bledbet commented Aug 26, 2016

I am trying to keep most of log4net configuration externalized in xml for our apps, but with something like the UDP appender, I would need to route the log messages to a different address and/or port depending on what region (dev, test, or prod) the app is running in. I was thinking I could add the GelfUdpAppender in the xml configuration with a bogus address (or localhost), and then run-time re-configure the address. I tried this, and I got no errors, but the messages aren't delivered to the graylog listener, so I'm guessing that at this point, the appender has already created it's socket connection using the address from the xml configuration, and won't do so again. Do you have a recommendation on how such a thing could be accomplished? I could maintain region-specific log4net configurations, and bootstrap log4net with the right one, but I don't like the duplication (maintenance) that comes with this option. I think I could also just do all instantiation of the gelf appender in code - this is workable, I just prefered having MOST of the configuration of all appenders in the xml (for example, keeping all conversion patterns for all appenders in one place).

Thanks in advance for any suggestions you might have!

@bledbet
Copy link
Author

bledbet commented Aug 26, 2016

Apologies - I think I figured it out - I was setting appender.RemostHostName at runtime instead of appender.RemoteAddress. With that change, it appears to work as desired.

Thanks for the great work!

@Pliner
Copy link
Owner

Pliner commented Aug 26, 2016

If you have any more questions do not hesitate to ask 😉

@Pliner Pliner closed this as completed Aug 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants