Request for changes-105: Simplify logging of composite applications

From OTBWiki
Jump to: navigation, search

[Request for Changes - 105] Simplify logging of composite applications

Status

  • Author: Guillaume
  • Additional Contributors (if different than authors)
  • Submitted on 31/07/2017
  • Proposed target release 6.2
  • Adopted : +3 (Victor, Rémi, Guillaume)
  • Merged : c91e5c4289a6a95118ec12c0111addf343989813

Summary

This is a small addition to the ApplicationEngine to have composite application logs in the right order.

Rationale

A feedback on the composite application has shown that it is weird to see the log messages with the progress bars happen before the normal outputs of the internal application.

Implementation details

Classes and files

M       Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx

In the class otb::Wrapper::Application :

  • a new method SetLogger() has been added, so that an application can receive a different logger.
  • the method GetLogger() becomes const
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperCompositeApplication.cxx

The logging system in otb::Wrapper::CompositeApplication has been simplified because now the internal applications share the same logger instance as the composite application. It means less code, and transparent logging. A small example of log output with TrainImagesClassifier :

Before:

2017-07-31 18:22:38 (INFO): Polygon analysis...
Analyse polygons...: 100% [**************************************************] (0.008 seconds)
2017-07-31 18:22:38 (INFO): 
2017-07-31 18:22:38 (INFO): Elevation management: setting default height above ellipsoid to 0 meters
2017-07-31 18:22:38 (INFO): Reprojecting input vectors...

2017-07-31 18:22:38 (INFO): Sampling rates...
2017-07-31 18:22:38 (INFO): 
2017-07-31 18:22:38 (INFO): Sampling strategy : fit the number of samples based on the smallest class
2017-07-31 18:22:38 (INFO): Sampling rates for image 1 :  className  requiredSamples  totalSamples  rate
1	85	4238	0.0200566
2	85	563	0.150977
3	85	9561	0.00889028
4	85	85	1


2017-07-31 18:22:38 (INFO): Sample selection...
Selecting positions with periodic sampler...: 100% [**************************************************] (0.01 seconds)
2017-07-31 18:22:38 (INFO): 
2017-07-31 18:22:38 (INFO): Elevation management: setting default height above ellipsoid to 0 meters
2017-07-31 18:22:38 (INFO): Sampling strategy : set number of samples for each class
2017-07-31 18:22:38 (INFO): Sampling rates :  className  requiredSamples  totalSamples  rate
1	85	4238	0.0200566
2	85	563	0.150977
3	85	9561	0.00889028
4	85	85	1

2017-07-31 18:22:38 (INFO): Reprojecting input vectors...

After:

2017-07-31 18:25:54 (INFO): Polygon analysis...
2017-07-31 18:25:54 (INFO): Elevation management: setting default height above ellipsoid to 0 meters
2017-07-31 18:25:54 (INFO): Reprojecting input vectors...
Analyse polygons...: 100% [**************************************************] (0.008 seconds)
2017-07-31 18:25:54 (INFO): Sampling rates...
2017-07-31 18:25:54 (INFO): Sampling strategy : fit the number of samples based on the smallest class
2017-07-31 18:25:54 (INFO): Sampling rates for image 1 :  className  requiredSamples  totalSamples  rate
1	85	4238	0.0200566
2	85	563	0.150977
3	85	9561	0.00889028
4	85	85	1

2017-07-31 18:25:54 (INFO): Sample selection...
2017-07-31 18:25:54 (INFO): Elevation management: setting default height above ellipsoid to 0 meters
2017-07-31 18:25:54 (INFO): Sampling strategy : set number of samples for each class
2017-07-31 18:25:54 (INFO): Sampling rates :  className  requiredSamples  totalSamples  rate
1	85	4238	0.0200566
2	85	563	0.150977
3	85	9561	0.00889028
4	85	85	1

2017-07-31 18:25:54 (INFO): Reprojecting input vectors...
Selecting positions with periodic sampler...: 100% [**************************************************] (0.01 seconds)

Applications

Changes are transparent for derived classes.

Tests

Documentation

Additional notes