Comments (8)
Can you elaborate on the use case you are looking for?
Is it that we want to changes the identifier
, options
, and facility
dynamically on the appender at run time? Or, is it only after a process is forked that we need to change one or more of them?
from semantic_logger.
Well for example, currently the railtie for semantic_logger adds the application name for rails. If I wanted to use a different identifier I'd have to reopen it using Syslog.reopen('my-new-id', ...)
. So, I guess it would be the first use case. I'm not sure how common it is to do this but it's currently what I have to do in order for it to work.
from semantic_logger.
Are you referring to the :ident
option that is used when you create the appender?
syslog_appender = SemanticLogger::Appender::Syslog.new(ident: 'my-new-id', server: 'tcp://myloghost:514')
SemanticLogger.add_appender(syslog_appender)
The application / class name, for example Rails
, ActiveRecord
, MyClass
is set in every logging instance when it is created so that every log message contains the application / class name from the relevant logging instance.
All of these messages are sent to the same single appender, so dynamically changing the appender at run time ( which is running on a separate thread ) can lead to unpredictable results.
If we need to change something with every log message that is sent to syslog, then we need to specify it in the log message itself.
from semantic_logger.
Yes, I'm referring to the :ident
option that is used to create the appender. Are you saying I'd have to create a new syslog appender to give it a new ident? I know each instance has its own name given by SemanticLogger[SomeClass]
However, Syslog would still output the ident portion which is what I need changed. Also, you can't create more than one instance of the Syslog appender so creating a new instance is not a solution.
from semantic_logger.
I am still trying to understand the use-case, is setting the :ident
up front when you create the appender not sufficient?
If not, do you want the :ident
that is used with every Syslog message to be changed to the application or class name?
from semantic_logger.
On my use-case the ident would be change only once after the syslog appender is initialized. So it gets initialized with a common identifier, then it gets changed based on the application's name only once. Something like a configuration after its been appender has been loaded. Maybe its not a common use case and i'll just have to think of a way to implement this without changing the gem.
from semantic_logger.
I would suggest only adding the Syslog appender once you know the applications name, then you can pass in the correct :ident
just once.
Otherwise you can remove the existing Syslog appender and add a new one.
from semantic_logger.
Thanks for the advice!
from semantic_logger.
Related Issues (20)
- Default formatter doesn't return context by default. HOT 1
- Semantic Logger removes keys from hash passed to loggers
- Support message and payload (v5 feature request) HOT 7
- Cannot use Sentry.init properly with sentry-ruby appender HOT 2
- Add support for New Relic log forwarding feature HOT 9
- Elasticsearch Specifying types in bulk requests is deprecated HOT 4
- Log level signal trap omits :fatal and :error levels HOT 2
- Suggestion: Change Loggable logger initialization from lazy to eager HOT 5
- RSpec test suite hangs intermittently unless `sync!` has been called HOT 1
- SemanticLogger.sync! is Not Thread-Safe
- Semantic Logger + Sidekiq 7 HOT 3
- Exception on `logger.error({ payload: '', foo: 'bar' })` (trying to log an arbitrary hash with `payload` key) HOT 1
- HTTP appender / Possible to write custom Headers HOT 1
- Segmentation fault in Formatters::Base for async appender HOT 2
- Improve CaptureLogEvents test logger HOT 1
- Error is raised when logging first occurs in a signal trap
- Base formatter time_format docs and behavior conflict, with no way to initialize it to nil in the ctor.
- Calling 'reopen' and Adding an Appender Creates 2 Logging Threads HOT 2
- Release Version 4.13 HOT 1
- Intermittent `NameError`/`LoadError` when loading Rails environment HOT 3
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 semantic_logger.