Skip to content

Commit

Permalink
Adds method logfileLocation()
Browse files Browse the repository at this point in the history
This introduce dependencies to ch.qos.logback.core 
and ch.qos.logback.classic to net.bioclipse.business
  • Loading branch information
goglepox committed Feb 8, 2013
1 parent 8f7c48b commit 753c2f0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/net.bioclipse.business/META-INF/MANIFEST.MF
Expand Up @@ -10,7 +10,10 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.core.resources,
net.bioclipse.core,
net.bioclipse.ui
net.bioclipse.ui,
ch.qos.logback.core,
ch.qos.logback.classic
Bundle-ActivationPolicy: lazy
Import-Package: org.apache.log4j
Import-Package: org.apache.log4j,
org.slf4j
Export-Package: net.bioclipse.business
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
Expand All @@ -34,6 +35,13 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.FileAppender;

public class BioclipsePlatformManager implements IBioclipseManager {

Expand All @@ -59,6 +67,19 @@ public void wiki() throws BioclipseException {
}
}

public String logfileLocation() {
LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();
for (Logger logger : context.getLoggerList()) {
for (Iterator<Appender<ILoggingEvent>> index = logger.iteratorForAppenders(); index.hasNext();) {
Appender<ILoggingEvent> appender = index.next();
if(appender instanceof FileAppender) {
return ((FileAppender)appender).getFile();
}
}
}
return "";
}

public void bugTracker() throws BioclipseException {
try {
openURL(new URL("http://bugs.bioclipse.net"));
Expand Down
Expand Up @@ -90,4 +90,9 @@ public String downloadAsFile(String url, String mimeType,
public void requireVersion( String lowerVersionBound,
String upperVersionBound )
throws BioclipseException;

@PublishedMethod(
methodSummary="Returns the location of the current logfile"
)
public String logfileLocation();
}

0 comments on commit 753c2f0

Please sign in to comment.