Git Product home page Git Product logo

Comments (8)

reidmorrison avatar reidmorrison commented on June 15, 2024

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.

Tonkpils avatar Tonkpils commented on June 15, 2024

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.

reidmorrison avatar reidmorrison commented on June 15, 2024

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.

Tonkpils avatar Tonkpils commented on June 15, 2024

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.

reidmorrison avatar reidmorrison commented on June 15, 2024

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.

Tonkpils avatar Tonkpils commented on June 15, 2024

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.

reidmorrison avatar reidmorrison commented on June 15, 2024

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.

Tonkpils avatar Tonkpils commented on June 15, 2024

Thanks for the advice!

from semantic_logger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.