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

Replace sys.out by logger #582

Open
sschulz92 opened this issue Nov 1, 2021 · 1 comment
Open

Replace sys.out by logger #582

sschulz92 opened this issue Nov 1, 2021 · 1 comment

Comments

@sschulz92
Copy link
Contributor

uDig has a lot of sys.out calls, which should be replaced by a logger. This improves the code-quality a lot including error handling within the RCP client.

Example:

CreateAndSelectNewFeature.java

if (fid != null) {
        System.out.println("Create and select feature:" + fid); //$NON-NLS-1$
} else {
        System.out.println(
                "Create and select feature did not produce a feature id to select"); //$NON-NLS-1$
}
@fgdrf
Copy link
Contributor

fgdrf commented Nov 1, 2021

Totally agree, at the time of writing we have 503 places with System.out in java-files and 45 occurences in other resources (such as rst sphinx files).

IMHO it makes sense to think about a common approach to provide logging-functionality within uDig. In almost each bundle Activator we find methods such as

public static void log( String message2, Throwable e );
public static void log( IStatus status );
public static void trace( String traceID, Class< ? > caller, String message, Throwable e );
public static void trace( Class< ? > caller, String message, Throwable e );

I guess these duplicated code blocks just differs in used Plugin-Id in implementation.

What Do you think about creating a LoggingHelper Class in org.locationtech.udig.core with method-signatures to provide the bundle to create log messages for.

public static void log( Bundle bundle, String message, Throwable e );

However, this refactoring should be independently from clean-up sysouts ;) I'll create an issue to cleanup-duplicated log/trace implementations ;)

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

No branches or pull requests

2 participants