Skip to content

Conversation

gvachkov
Copy link
Contributor

@gvachkov gvachkov commented Jun 6, 2018

No description provided.

README.rst Outdated
Setting and getting correlation ID
""""""""""""""""""""""""""""""""""

When using cf_logging in a web application you don't need to care about setting and getting correlation ID,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to care about setting and getting correlation ID-> you don't need to get or set the correction ID

README.rst Outdated
""""""""""""""""""""""""""""""""""

When using cf_logging in a web application you don't need to care about setting and getting correlation ID,
because the logging frameworks supported will fetch it from HTTP headers and will set it to the log output for you.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the logging frameworks supported will fetch it from HTTP headers and will set it to the log output for you. -> because the logging library will fetch it from the HTTP headers and set it.

README.rst Outdated

When using cf_logging in a web application you don't need to care about setting and getting correlation ID,
because the logging frameworks supported will fetch it from HTTP headers and will set it to the log output for you.
But if you are developing an application triggered via cli or messaging or by schedule, you might want to set the correlation ID manually,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For non-web applications you have to set the correlation ID manually, as it is used for filtering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not mandatory to set correlation ID, only if app developer would like to. If available it might be used by application admin to filter the logs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For non-web applications you could to set the correlation ID manually, as it could be used for filtering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is obvious

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I was typing the message I think we should have in the readme.
"For non-web applications you could to set the correlation ID manually, as it could be used for filtering."
instead of
"But if you are developing an application triggered via cli or messaging or by schedule, you might want to set the correlation ID manually, so all log entries can be filtered lately based on this correlation_id."

sorter.

README.rst Outdated
But if you are developing an application triggered via cli or messaging or by schedule, you might want to set the correlation ID manually,
so all log entries can be filtered lately based on this correlation_id.

Setting and getting correlation_id can be done via:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*the correlation_id

README.rst Outdated
cf_logging.FRAMEWORK.context.get_correlation_id()
cf_logging.FRAMEWORK.context.set_correlation_id(value)
The context created in cf_logging that have been initialized when no specific framework is used (like ``cf_logging.init()``) is global which means that setting correlation_id will result in same correlatino_id for the all logs from this point on.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever a correlation id is set after initializing cf_logging without a specific framework (ex: cf_logging.init()) - the correlation id set would be used for each log.

If you need a thread .... and provide your own thread safe context implementation.

README.rst Outdated
The context created in cf_logging that have been initialized when no specific framework is used (like ``cf_logging.init()``) is global which means that setting correlation_id will result in same correlatino_id for the all logs from this point on.
If you need thread safe correlation_id, you can reuse the ``cf_logging.job_loffing.framework.JobFramework`` and provide own context implementation that is thread safe.

If you need to get the correlation_id in web application, take into account the framework you are using.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above we say that for web frameworks we don't have to worry about getting or setting the correction id.
Why would a user need to get the correlation id in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In use-cases when for example http request triggers new message in MQ, which in turn is used to trigger new job where correlation_id contained in the message (fetched from HTTP request) will be set to logging lib.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case from above: in a web application you don't need to care about setting and getting correlation ID
We should remove the 'getting' - as it a valid use case?
So a user doesn't have to set it, but could still have to get it.

README.rst Outdated
The context created in cf_logging that have been initialized when no specific framework is used (like ``cf_logging.init()``) is global which means that setting correlation_id will result in same correlatino_id for the all logs from this point on.
If you need thread safe correlation_id, you can reuse the ``cf_logging.job_loffing.framework.JobFramework`` and provide own context implementation that is thread safe.

If you need to get the correlation_id in web application, take into account the framework you are using.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in *a web application

@gvachkov gvachkov merged commit 0807c65 into master Jun 7, 2018
@gvachkov gvachkov deleted the job-logging branch June 7, 2018 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants