Logging of logs only on demand

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Logging of logs only on demand

Kavitha Balan Nair
Hi,

 

Is there any way to make the loggings on demand?  what happens is once the service is started it logs with the change in time stamp even though there are no any details to be logged.

Log4j2.10 is been used in the project

 

Thanks,

Kavitha
Reply | Threaded
Open this post in threaded view
|

Re: Logging of logs only on demand

Tungathurthi, Chandra Kiran Bharadwaj
ThreadContext + Filters is your friend :)

Best,
Chandra

On 5 Feb 2018, 3:40 PM +0530, Kavitha Balan Nair <[hidden email]>, wrote:

> Hi,
>
>
>
> Is there any way to make the loggings on demand? what happens is once the service is started it logs with the change in time stamp even though there are no any details to be logged.
>
> Log4j2.10 is been used in the project
>
>
>
> Thanks,
>
> Kavitha
Reply | Threaded
Open this post in threaded view
|

Re: Logging of logs only on demand

Matt Sicker
See also the monitorInterval setting so you can change the config file and
it gets refreshed automatically.

If you're looking for a programmatic way to do it, you could follow the
example set by Spring Boot 1.x in how they delay logging until a certain
point. (Generally involves registering a filter and removing it when ready
to log).

On 5 February 2018 at 04:31, Chandra <[hidden email]>
wrote:

> ThreadContext + Filters is your friend :)
>
> Best,
> Chandra
>
> On 5 Feb 2018, 3:40 PM +0530, Kavitha Balan Nair <
> [hidden email]>, wrote:
> > Hi,
> >
> >
> >
> > Is there any way to make the loggings on demand? what happens is once
> the service is started it logs with the change in time stamp even though
> there are no any details to be logged.
> >
> > Log4j2.10 is been used in the project
> >
> >
> >
> > Thanks,
> >
> > Kavitha
>



--
Matt Sicker <[hidden email]>