From 394f409032f5af13a34faac251d9929ef64729d1 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Fri, 24 Oct 2014 12:10:22 +0200 Subject: Output System informations --- .../at/gv/egiz/pdfas/lib/api/PdfAsFactory.java | 25 ++++++++++++++++++++++ .../egiz/pdfas/lib/impl/pdfbox/PDFBOXBackend.java | 13 +++++++++++ 2 files changed, 38 insertions(+) diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java index acfb7ef5..ae5d7aca 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java @@ -32,6 +32,9 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.lang.management.ManagementFactory; +import java.lang.management.OperatingSystemMXBean; +import java.lang.management.RuntimeMXBean; import java.security.Provider; import java.security.Security; import java.util.zip.ZipEntry; @@ -119,6 +122,27 @@ public class PdfAsFactory implements IConfigurationConstants { logger.info(str); } + private static void showRuntimeInformation() { + try { + RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); + OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean(); + teeInformation("+ OS Name: " + osBean.getName()); + teeInformation("+ OS Version: " + osBean.getVersion()); + teeInformation("+ OS Arch: " + osBean.getArch()); + teeInformation("+ JAVA Version: " + runtimeBean.getSystemProperties().get("java.runtime.version")); + teeInformation("+ JAVA Spec ----------------------------------------------------------"); + teeInformation("+ JAVA Spec Name: " + runtimeBean.getSpecName()); + teeInformation("+ JAVA Spec Version: " + runtimeBean.getSpecVersion()); + teeInformation("+ JAVA Spec Vendor: " + runtimeBean.getSpecVendor()); + teeInformation("+ JAVA VM ----------------------------------------------------------"); + teeInformation("+ JAVA VM Name: " + runtimeBean.getVmName()); + teeInformation("+ JAVA VM Version: " + runtimeBean.getVmVersion()); + teeInformation("+ JAVA VM Vendor: " + runtimeBean.getVmVendor()); + } catch(Throwable e) { + teeInformation("+ Failed to show runtime informations"); + } + } + /** * Configure log. * @@ -134,6 +158,7 @@ public class PdfAsFactory implements IConfigurationConstants { teeInformation("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); teeInformation("+ PDF-AS: " + getVersion()); teeInformation("+ PDF-AS SCM Revision: " + getSCMRevision()); + showRuntimeInformation(); registerSecurityProvider(configuration); teeInformation("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXBackend.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXBackend.java index ba1e0088..949d5cc5 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXBackend.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox/PDFBOXBackend.java @@ -1,5 +1,8 @@ package at.gv.egiz.pdfas.lib.impl.pdfbox; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.gv.egiz.pdfas.lib.backend.PDFASBackend; import at.gv.egiz.pdfas.lib.impl.pdfbox.placeholder.PDFBoxPlaceholderExtractor; import at.gv.egiz.pdfas.lib.impl.placeholder.PlaceholderExtractor; @@ -12,6 +15,16 @@ public class PDFBOXBackend implements PDFASBackend { private static final String NAME = "PDFBOX_BACKEND"; + private static final Logger logger = LoggerFactory + .getLogger(PDFBOXBackend.class); + + static { + logger.info(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + logger.info(" + PDFBOX Backend created"); + logger.info(" + PDFBOX Version used: " + org.apache.pdfbox.Version.getVersion()); + logger.info(" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + } + @Override public String getName() { return NAME; -- cgit v1.2.3