Question

I have an application that takes some time to perform an upgrade taks. Support engineers can follow the progress by looking an the log-file regularly. This is a low-tech solution, but this works for our support team.

They will see something like this in the log file:

2013-10-22 - Upgrade progress: x

After 10 seconds, the same line is now: (not a new line)

2013-10-22 - Upgrade progress: xxx

After the upgrade:

2013-10-22 - Upgrade progress: xxxxxxxxxxxxxxxxxxx - Finished

Is this possible with logback?

Was it helpful?

Solution

To be frank, I'm not clear what the value of modifying a log entry would be. I'd image it would be far more useful to support engineers to have a running log of progress percent at point in time.

E.g.:

2014-01-01 10:10:10 - INFO - Upgrade progress: 1%
2014-01-01 10:10:15 - INFO - Upgrade progress: 5%
2014-01-01 10:10:20 - WARN - Upgrade encountered missed dependency, correcting
2014-01-01 10:10:21 - INFO - Upgrade dependency resolved
2014-01-01 10:10:25 - INFO - Upgrade progress: 10%
...
2014-01-01 10:12:51 - INFO - Upgrade progress: 100% - Finished

That way, a support engineer gets both useful indications of current progress, AND that progress will be blended with important notices or other indications of the actual work that the process is doing.

As for the specific question at hand, I don't know of a way to do that without seriously tweaking how logback functions -- it's meant to create a running log of appended entries, not modify existing ones. That runs quite entirely against the grain of logback, or any append-based logging framework.

OTHER TIPS

I guess in theory in might be possible to do something like this by implementing a custom appender (see http://logback.qos.ch/manual/appenders.html) but this really is not what logging is for and therefor certainly isn't part of the standard implementation of logback.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top