Closed rameswar closed 11 years ago
Hi, Where do you see the log messages ? If it is in gs.log : this is normal : Java is by passed if you redirect directly gs stdout. Did you try removing your "-sstdout" switch and setting a Java logger to log org.ghost4j messages to a file ?
Hello,
The thing is I added the log4j.properties to the classpath and then I tried not log into that "xyz.log" file(Which is not the stdout related log file). But it is still logging into the xyz.log file.
log4j.rootLogger=DEBUG, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %5p (%F:%L) - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=c:\xyz.log log4j.appender.R.MaxFileSize=1000KB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss} %p %c - %m%n
I tried the previous posted program with this log4j details but it is still logging into the log4j log file.
Regards, Rameswar
Ok : if you modify GhostscriptLoggerOutputStream to stop logging by adding a command on the log line. Does it still log ?
Hello,
The program which is on top, there I am trying not to log in the log4j related log file. But still it's logging. After setting the GhostscriptLoggerOutputStream as Level.OFF. So I want to log into some other file in place of the default log4j logging file. But the thing is in Ghost4j I am unable to get the control of the logging mechanism. How can I do this?
Regards, Rameswar
Write your own GhostscriptLoggerOutputStream
Hi, I configured the Log4j in different way by which it's able to log all the log4j msg into separate log file.
Thanks for your quick replies and suggestions.
Good !
Hi,
I do not want log the msg into log file. So I set Level as OFF. But it is not responding. public static void main(String[] args) { String[] gsArgs = new String[8]; gsArgs[0] = "-q"; gsArgs[1] = "-dNOPAUSE"; gsArgs[2] = "-r300"; gsArgs[4] = "-sDEVICE=tiffg4"; gsArgs[5] = "-dBATCH"; gsArgs[6] = "-sstdout=gs.log"; gsArgs[7] = "-sOutputFile=123.tif"; gsArgs[7] = "123.pdf"; GhostscriptLoggerOutputStream gsloggerOutStream = new GhostscriptLoggerOutputStream(Level.OFF); Ghostscript ghostscript = Ghostscript.getInstance(); ghostscript.setStdOut(gsloggerOutStream); ghostscript.setStdErr(gsloggerOutStream);
try { gs.initialize(gsArgs); gs.exit(); } catch (GhostscriptException e) { e.printStackTrace(); System.out.println("ERROR: " + e.getMessage()); } }
Regards, Rameswar