Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MATLAB: add logging initialization function #2272

Merged
merged 16 commits into from
Mar 9, 2016

Conversation

sbesson
Copy link
Member

@sbesson sbesson commented Mar 5, 2016

Fixes #2233

This PR addresses the issues reported in #2233 by:

  • adding a MATLAB function initializing the logging system with a logic similar to logging.basicConfig.
  • set the default logging level to WARN if no argument is passed
  • use this logging initialization function in bfopen to prevent logging set by the user to be overriden
  • add some logic checking whether logging is enabled to loci.common.DebugTools

To test this PR:

  • try the following workflow from a clear MATLAB session using the test artifacts:

    % Open an image - logging should be initialized at WARN level
    data = bfopen(id);
    % Check whether logging is enabled
    loci.common.DebugTools.isEnabled()
    % Set the logging level to debug
    loci.common.DebugTools.enableLogging('DEBUG');
    % Open the image again - logging should be at DEBUG level
    data = bfopen(id);
    
  • check the new MATLAB tests are passing

  • check bftest.m completes as expected in the CI job and that the individual workers in the parfor loop have their logging system properly intialized.

@bramalingam
Copy link
Member

Works as expected,

>> c1 = bfopen();
log4j:WARN No appenders could be found for logger (loci.formats.FormatHandler).
log4j:WARN Please initialize the log4j system properly.
Reading series #1
    ...
>> loci.common.DebugTools.isEnabled()

ans =

     1

>> loci.common.DebugTools.enableLogging('DEBUG');
>> c1 = bfopen();
TiffDelegateReader initializing /Users/bramalingam/Desktop/myfile.tiff
TiffDelegateReader initializing /Users/bramalingam/Desktop/myfile.tiff
loci.formats.in.TiffDelegateReader.initFile(/Users/bramalingam/Desktop/myfile.tiff)
TiffReader initializing /Users/bramalingam/Desktop/myfile.tiff
loci.formats.in.TiffReader.initFile(/Users/bramalingam/Desktop/myfile.tiff)
Reading IFDs
Populating metadata
Checking comment style
Populating OME metadata
Expected positive value for PhysicalSize; got Infinity
Reading series #1
    .Reading tile Length 8064 Offset 16
Reading tile Length 8064 Offset 8080
Reading tile Length 8064 Offset 16144
Reading tile Length 8064 Offset 24208
Reading tile Length 8064 Offset 32272
Reading tile Length 8064 Offset 40336
Reading tile Length 8064 Offset 48400
Reading tile Length 8064 Offset 56464
Reading tile Length 8064 Offset 64528
Reading tile Length 8064 Offset 72592
Reading tile Length 8064 Offset 80656
Reading tile Length 8064 Offset 88720
Reading tile Length 8064 Offset 96784
Reading tile Length 8064 Offset 104848
Reading tile Length 8064 Offset 112912
Reading tile Length 8064 Offset 120976
Reading tile Length 8064 Offset 129040
Reading tile Length 8064 Offset 137104
Reading tile Length 8064 Offset 145168
Reading tile Length 8064 Offset 153232
Reading tile Length 8064 Offset 161296
Reading tile Length 8064 Offset 169360
Reading tile Length 8064 Offset 177424
Reading tile Length 8064 Offset 185488
Reading tile Length 8064 Offset 193552
Reading tile Length 8064 Offset 201616
Reading tile Length 8064 Offset 209680
Reading tile Length 8064 Offset 217744
Reading tile Length 8064 Offset 225808
Reading tile Length 8064 Offset 233872
Reading tile Length 8064 Offset 241936
Reading tile Length 2304 Offset 250000
..
Location.mapFile: embedded-stream.raw -> null
Location.mapFile: embedded-stream.raw -> null

Good to merge, if the code changes suggested by @jburel are taken care of..

@sbesson
Copy link
Member Author

sbesson commented Mar 7, 2016

@bramalingam / @jburel: pushed.

@sbesson sbesson added the develop label Mar 7, 2016
@@ -65,12 +65,36 @@ public static String getStackTrace(Throwable t) {
}

/**
* Checks wether SLF4J logging has been enabled via logback or log4j
Copy link
Member

Choose a reason for hiding this comment

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

whether

@jburel
Copy link
Member

jburel commented Mar 9, 2016

a typo missed by @mtbc ;-): intializes

@sbesson
Copy link
Member Author

sbesson commented Mar 9, 2016

Fixed the typo reported in d76bc0c. Assuming there are no more functional comments and since the merge jobs are green, I propose to merge this PR to unlock this follow-up logging work addressing http://trac.openmicroscopy.org/ome/ticket/13151.

melissalinkert added a commit that referenced this pull request Mar 9, 2016
MATLAB: add logging initialization function
@melissalinkert melissalinkert merged commit eca4910 into ome:develop Mar 9, 2016
@sbesson sbesson deleted the bfinitlogging branch March 9, 2016 21:15
@sbesson sbesson added this to the 5.2.0 milestone Apr 19, 2016
@sbesson sbesson mentioned this pull request Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants