Revision 3275
Added by Jing Tao over 17 years ago
src/edu/ucsb/nceas/metacat/MetaCatUtil.java | ||
---|---|---|
864 | 864 |
} |
865 | 865 |
|
866 | 866 |
} |
867 |
|
|
868 |
/** |
|
869 |
* Writes debug information into a file in delimitered format |
|
870 |
* @param debugInfo the debug information |
|
871 |
* @param newLine append the debug info to a line or not |
|
872 |
*/ |
|
873 |
public static void writeDebugToDelimiteredFile(String debugInfo, boolean newLine) |
|
874 |
{ |
|
875 |
String debug = MetaCatUtil.getOption("writeDebugToFile"); |
|
876 |
if (debug != null && debug.equalsIgnoreCase("true")) |
|
877 |
{ |
|
878 |
try |
|
879 |
{ |
|
880 |
File outputFile = new File(MetaCatUtil.getOption("delimiteredOutputFile")); |
|
881 |
FileOutputStream fos = new FileOutputStream(outputFile, true); |
|
882 |
PrintWriter pw = new PrintWriter(fos); |
|
883 |
if (newLine) |
|
884 |
{ |
|
885 |
pw.println(debugInfo); |
|
886 |
} |
|
887 |
else |
|
888 |
{ |
|
889 |
pw.print(debugInfo); |
|
890 |
} |
|
891 |
pw.flush(); |
|
892 |
pw.close(); |
|
893 |
fos.close(); |
|
894 |
|
|
895 |
} |
|
896 |
catch(Exception io) |
|
897 |
{ |
|
898 |
logMetacat.warn("Eorr in writeDebugToDelimiteredFile "+io.getMessage()) ; |
|
899 |
} |
|
900 |
} |
|
901 |
|
|
902 |
} |
|
867 | 903 |
} |
Also available in: Unified diff
Add a new method to output delimited debug info.