removed calls to log4j. Logging sth. does not work yet

This commit is contained in:
hdaniels
2005-06-22 14:48:25 +00:00
parent e7a7f7b223
commit 46976becbd
17 changed files with 300 additions and 346 deletions

View File

@@ -3,8 +3,7 @@ package de.uka.ilkd.key.ocl.gf;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* A class that offers a basic readGfEdit method with a lot of
@@ -38,8 +37,8 @@ abstract class AbstractProber {
skipChild("<hmsg>");
try {
String next = fromProc.readLine();
if (logger.isDebugEnabled()) {
logger.debug("2 " + next);
if (logger.isLoggable(Level.FINER)) {
logger.finer("2 " + next);
}
return next;
} catch (IOException e) {
@@ -84,13 +83,13 @@ abstract class AbstractProber {
String next = "";
//read <gfedit>
String readresult = fromProc.readLine();
if (logger.isDebugEnabled()) {
logger.debug("1 " + next);
if (logger.isLoggable(Level.FINER)) {
logger.finer("1 " + next);
}
//read either <hsmg> or <lineatization>
readresult = fromProc.readLine();
if (logger.isDebugEnabled()) {
logger.debug("1 " + next);
if (logger.isLoggable(Level.FINER)) {
logger.finer("1 " + next);
}
next = readHmsg(readresult);
@@ -101,8 +100,8 @@ abstract class AbstractProber {
while ((next!=null)&&((next.length()==0)||(!next.trim().equals("<linearizations>")))) {
next = fromProc.readLine();
if (next!=null){
if (logger.isDebugEnabled()) {
logger.debug("1 " + next);
if (logger.isLoggable(Level.FINER)) {
logger.finer("1 " + next);
}
} else {
System.exit(0);
@@ -115,8 +114,8 @@ abstract class AbstractProber {
for (int i=0; i<3 && !next.equals(""); i++){
next = fromProc.readLine();
if (logger.isDebugEnabled()) {
logger.debug("1 " + next);
if (logger.isLoggable(Level.FINER)) {
logger.finer("1 " + next);
}
}
@@ -135,13 +134,13 @@ abstract class AbstractProber {
String closing = (new StringBuffer(opening)).insert(1, '/').toString();
try {
String nextRead = fromProc.readLine();
if (logger.isDebugEnabled()) {
logger.debug("3 " + nextRead);
if (logger.isLoggable(Level.FINER)) {
logger.finer("3 " + nextRead);
}
while (!nextRead.trim().equals(closing)) {
nextRead = fromProc.readLine();
if (logger.isDebugEnabled()) {
logger.debug("3 " + nextRead);
if (logger.isLoggable(Level.FINER)) {
logger.finer("3 " + nextRead);
}
}
} catch (IOException e) {
@@ -156,8 +155,8 @@ abstract class AbstractProber {
* @param text the command, exactly the string that is going to be sent
*/
protected void send(String text) {
if (logger.isDebugEnabled()) {
logger.debug("## send: '" + text + "'");
if (logger.isLoggable(Level.FINER)) {
logger.finer("## send: '" + text + "'");
}
try {
toProc.write(text, 0, text.length());

View File

@@ -1,6 +1,6 @@
package de.uka.ilkd.key.ocl.gf;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* @author daniels

View File

@@ -9,7 +9,7 @@ import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import org.apache.log4j.Logger;
import java.util.logging.*;
//import de.uka.ilkd.key.util.KeYResourceManager;
@@ -61,21 +61,21 @@ ActionListener{
public void valueChanged(TreeSelectionEvent e) {
if (tree.getSelectionRows() != null) {
if (gfeditor.nodeTable == null) {
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("null node table");
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("null node table");
}
} else {
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("node table: " + gfeditor.nodeTable.contains(new Integer(0)) + " " + gfeditor.nodeTable.keys().nextElement());
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("node table: " + gfeditor.nodeTable.contains(new Integer(0)) + " " + gfeditor.nodeTable.keys().nextElement());
}
}
if (tree.getSelectionPath() == null) {
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("null root path");
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("null root path");
}
} else {
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("selected path" + tree.getSelectionPath());
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("selected path" + tree.getSelectionPath());
}
}
int i = ((Integer) gfeditor.nodeTable.get(tree.getSelectionPath())).intValue();
@@ -166,8 +166,8 @@ ActionListener{
* as the parent
*/
public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, Object child, boolean shouldBeVisible) {
if (logger.isDebugEnabled()) {
logger.debug("node added: '" + child + "', parent: '" + parent + "'");
if (logger.isLoggable(Level.FINER)) {
logger.finer("node added: '" + child + "', parent: '" + parent + "'");
}
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
@@ -205,9 +205,9 @@ ActionListener{
exc.printStackTrace();
}
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("The user has finished editing the node.");
GFEditor2.treeLogger.debug("New value: " + node.getUserObject());
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("The user has finished editing the node.");
GFEditor2.treeLogger.finer("New value: " + node.getUserObject());
}
}
public void treeNodesInserted(TreeModelEvent e) {
@@ -298,8 +298,8 @@ ActionListener{
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
tree.setSelectionRow(selRow);
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("selection changed!");
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("selection changed!");
}
maybeShowPopup(e);
}
@@ -308,12 +308,12 @@ ActionListener{
//nothing to be done here
}
void maybeShowPopup(MouseEvent e) {
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("may be show Popup!");
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("may be show Popup!");
}
if (e.isPopupTrigger()) {
if (GFEditor2.treeLogger.isDebugEnabled()) {
GFEditor2.treeLogger.debug("changing menu!");
if (GFEditor2.treeLogger.isLoggable(Level.FINER)) {
GFEditor2.treeLogger.finer("changing menu!");
}
popup = gfeditor.producePopup();
popup.show(e.getComponent(), e.getX(), e.getY());

View File

@@ -1,11 +1,4 @@
/*
* Created on 20.04.2005
*/
package de.uka.ilkd.key.ocl.gf;
import org.apache.log4j.Logger;
/**
* @author daniels
* A class that represents a GF command together with its printname.
@@ -21,8 +14,6 @@ import org.apache.log4j.Logger;
*/
abstract class GFCommand implements Comparable{
protected static Logger subcatLogger = Logger.getLogger(GFEditor2.class.getName() + "_subcat");
/** the subcategory of this command */
public abstract String getSubcat();
/** the type of the command, r,w,ch,d,ac,... */

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,3 @@
/*
* Created on 06.05.2005
*
*/
package de.uka.ilkd.key.ocl.gf;
/**

View File

@@ -1,7 +1,5 @@
package de.uka.ilkd.key.ocl.gf;
import org.apache.log4j.Logger;
/**
* @author daniels
*
@@ -11,7 +9,6 @@ import org.apache.log4j.Logger;
* Reason: No GUI stuff in the command.
*/
class InputCommand extends GFCommand {
protected final static Logger logger = Logger.getLogger(Printname.class.getName());
public static InputCommand intInputCommand = new InputCommand("read in Integer",
"opens a dialog window in which an Integer can be entered",
int.class,

View File

@@ -2,8 +2,7 @@ package de.uka.ilkd.key.ocl.gf;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* @author daniels
@@ -114,7 +113,7 @@ class Printname {
try {
name = (String)this.paramNames.get(n);
} catch (ArrayIndexOutOfBoundsException e) {
subcatLogger.warn(e.getLocalizedMessage());
subcatLogger.warning(e.getLocalizedMessage());
}
return name;
}
@@ -204,8 +203,8 @@ class Printname {
String fullName = subcatPart.substring(indFull + 1, indFullEnd);
this.subcat = subcatPart.substring(0, indFull).trim();
this.subcatNameHashtable.put(this.subcat, fullName);
if (subcatLogger.isDebugEnabled()) {
subcatLogger.debug("new fullname '" + fullName + "' for category (shortname) '" + this.subcat + "'");
if (subcatLogger.isLoggable(Level.FINER)) {
subcatLogger.finer("new fullname '" + fullName + "' for category (shortname) '" + this.subcat + "'");
}
} else {
subcat = subcatPart.trim();
@@ -394,7 +393,7 @@ class Printname {
+ "<dd>" + this.paramTexts.get(which) + "</dd>";
return result;
} catch (ArrayIndexOutOfBoundsException e) {
subcatLogger.warn(e.getLocalizedMessage());
subcatLogger.warning(e.getLocalizedMessage());
return "";
}

View File

@@ -4,8 +4,7 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Hashtable;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* @author daniels
* asks GF to print all available printnames, parses that list and generates
@@ -37,8 +36,8 @@ public class PrintnameLoader extends AbstractProber {
protected void readMessage() {
try {
String result = this.fromProc.readLine();
if (nogger.isDebugEnabled()) {
nogger.debug("1 " + result);
if (nogger.isLoggable(Level.FINER)) {
nogger.finer("1 " + result);
}
//first read line is <message>, but this one gets filtered out in the next line
while (result.indexOf("/message")==-1){
@@ -50,12 +49,12 @@ public class PrintnameLoader extends AbstractProber {
}
result = this.fromProc.readLine();
if (nogger.isDebugEnabled()) {
nogger.debug("1 " + result);
if (nogger.isLoggable(Level.FINER)) {
nogger.finer("1 " + result);
}
}
if (nogger.isDebugEnabled()) {
nogger.debug("finished loading printnames");
if (nogger.isLoggable(Level.FINER)) {
nogger.finer("finished loading printnames");
}
} catch(IOException e){
System.err.println(e.getMessage());

View File

@@ -1,6 +1,6 @@
package de.uka.ilkd.key.ocl.gf;
import java.util.Hashtable;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* @author daniels
@@ -73,12 +73,12 @@ class PrintnameManager {
* @param myPrintname the printname given by GF
*/
protected void addNewPrintname(String myFun, String myPrintname, String type) {
if (logger.isDebugEnabled()) {
logger.debug("addNewPrintname, myFun = '" + myFun + "' , myPrintname = '" + myPrintname + "'");
if (logger.isLoggable(Level.FINER)) {
logger.finer("addNewPrintname, myFun = '" + myFun + "' , myPrintname = '" + myPrintname + "'");
}
Printname printname = new Printname(myFun, myPrintname, this.subcatNames, type);
if (logger.isDebugEnabled()) {
logger.debug("printname = '" + printname + "'");
if (logger.isLoggable(Level.FINER)) {
logger.finer("printname = '" + printname + "'");
}
this.printnames.put(myFun, printname);
}
@@ -110,7 +110,7 @@ class PrintnameManager {
// which does not occur in the refinement menu.
// if that is not wanted, don't call this method!
if (!myFun.startsWith("?")) {
logger.info("no printname for '" + myFun + "', pretend that it is a bound variable");
logger.fine("no printname for '" + myFun + "', pretend that it is a bound variable");
return new Printname(myFun);
}
}

View File

@@ -1,9 +1,3 @@
/*
* Created on 13.05.2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package de.uka.ilkd.key.ocl.gf;
import java.awt.BorderLayout;
@@ -23,7 +17,7 @@ import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* Takes care of reading in Strings that are to be parsed and terms.
@@ -166,23 +160,23 @@ class ReadDialog implements ActionListener{
termInput = inputField.getText();
if (termInput.indexOf(File.separatorChar)==-1){
owner.send("g "+termInput);
if (xmlLogger.isDebugEnabled()) xmlLogger.debug("sending term string");
if (xmlLogger.isLoggable(Level.FINER)) xmlLogger.finer("sending term string");
}
else {
owner.send("tfile "+termInput);
if (xmlLogger.isDebugEnabled()) {
xmlLogger.debug("sending file term: "+termInput);
if (xmlLogger.isLoggable(Level.FINER)) {
xmlLogger.finer("sending file term: "+termInput);
}
}
} else { //String selected
parseInput = inputField.getText();
if (parseInput.indexOf(File.separatorChar)==-1){
owner.send("p "+parseInput);
if (xmlLogger.isDebugEnabled()) xmlLogger.debug("sending parse string: "+parseInput);
if (xmlLogger.isLoggable(Level.FINER)) xmlLogger.finer("sending parse string: "+parseInput);
}
else {
owner.send("pfile "+parseInput);
if (xmlLogger.isDebugEnabled()) xmlLogger.debug("sending file parse string: "+parseInput);
if (xmlLogger.isLoggable(Level.FINER)) xmlLogger.finer("sending file parse string: "+parseInput);
}
}
readDialog.setVisible(false);

View File

@@ -1,12 +1,8 @@
/*
* Created on 21.04.2005
*
*/
package de.uka.ilkd.key.ocl.gf;
import java.util.HashSet;
import java.util.HashMap;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* @author daniels
@@ -36,8 +32,8 @@ class RealCommand extends GFCommand {
fullnames.put("ch", "change head");
fullnames.put("rc", "refine from history:");
}
if (logger.isDebugEnabled()) {
logger.debug("new RealCommand: " + myCommand);
if (logger.isLoggable(Level.FINEST)) {
logger.finest("new RealCommand: " + myCommand);
}
this.command = myCommand.trim();
this.showText = myShowText;

View File

@@ -1,6 +1,3 @@
/*
* Created on 27.04.2005
*/
package de.uka.ilkd.key.ocl.gf;
/**

View File

@@ -1,13 +1,6 @@
/*
* Created on 13.04.2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package de.uka.ilkd.key.ocl.gf;
import java.awt.Component;
import org.apache.log4j.Logger;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
@@ -19,8 +12,6 @@ import javax.swing.ListCellRenderer;
*/
public class ToolTipCellRenderer extends JLabel implements ListCellRenderer {
protected static Logger logger = Logger.getLogger(ToolTipCellRenderer.class.getName());
/**
* Returns a JLabel with a tooltip, which is given by the GFCommand
* @param list Well, the list this cell belongs to

View File

@@ -4,8 +4,7 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Hashtable;
import org.apache.log4j.Logger;
import java.util.logging.*;
/**
* @author daniels
@@ -14,7 +13,7 @@ import org.apache.log4j.Logger;
*/
public class TypesLoader extends AbstractProber {
protected final Hashtable hashtable;
protected static Logger nogger = Logger.getLogger(Printname.class.getName());
protected static Logger nogger = Logger.getLogger(TypesLoader.class.getName());
/**
* @param fromGf The GF process
* @param toGf The GF process
@@ -33,8 +32,8 @@ public class TypesLoader extends AbstractProber {
protected void readMessage() {
try {
String result = this.fromProc.readLine();
if (nogger.isDebugEnabled()) {
nogger.debug("7 " + result);
if (nogger.isLoggable(Level.FINER)) {
nogger.finer("7 " + result);
}
//first read line is <message>, but this one gets filtered out in the next line
while (result.indexOf("/message")==-1){
@@ -45,12 +44,12 @@ public class TypesLoader extends AbstractProber {
}
result = this.fromProc.readLine();
if (nogger.isDebugEnabled()) {
nogger.debug("7 " + result);
if (nogger.isLoggable(Level.FINER)) {
nogger.finer("7 " + result);
}
}
if (nogger.isDebugEnabled()) {
nogger.debug("finished loading printnames");
if (nogger.isLoggable(Level.FINER)) {
nogger.finer("finished loading printnames");
}
} catch(IOException e){
System.err.println(e.getMessage());
@@ -66,7 +65,9 @@ public class TypesLoader extends AbstractProber {
public void readTypes() {
//prints the last loaded grammar,
String sendString = "gf pg";
nogger.info("collecting types :" + sendString);
if (nogger.isLoggable(Level.FINE)) {
nogger.fine("collecting types :" + sendString);
}
send(sendString);
readGfedit();
}
@@ -82,8 +83,8 @@ public class TypesLoader extends AbstractProber {
final int typeStartIndex = line.indexOf(" : ") + 3;
final int typeEndIndex = line.lastIndexOf(" = ");
try {
final String type = line.substring(typeStartIndex, typeEndIndex);
this.hashtable.put(fun, type);
final String type = line.substring(typeStartIndex, typeEndIndex);
this.hashtable.put(fun, type);
} catch (StringIndexOutOfBoundsException e) {
System.err.println("line: '" + line + "'");
System.err.println("fun: '" + fun + "'");

View File

@@ -1,7 +1,3 @@
/*
* Created on 27.04.2005
*
*/
package de.uka.ilkd.key.ocl.gf;
/**

View File

@@ -11,14 +11,13 @@ package de.uka.ilkd.key.ocl.gf;
import java.io.File;
import java.util.logging.*;
import javax.swing.ProgressMonitor;
import org.apache.log4j.Logger;
//import org.apache.log4j.Logger;
public class Utils {
protected static Logger timeLogger = Logger.getLogger("de.uka.ilkd.key.ocl.gf.utils.timer");
protected static Logger deleteLogger = Logger.getLogger("de.uka.ilkd.key.ocl.gf.utils.delete");
protected static Logger timeLogger = Logger.getLogger(Utils.class.getName() + ".timer");
protected static Logger deleteLogger = Logger.getLogger(Utils.class.getName() + ".delete");
private Utils() {
//non-instantiability enforced
@@ -48,8 +47,8 @@ public class Utils {
*/
public static void tickProgress(ProgressMonitor pm, int progress, String note) {
if (note != null) {
if (timeLogger.isDebugEnabled()) {
timeLogger.debug(System.currentTimeMillis() + " : " + note);
if (timeLogger.isLoggable(Level.FINER)) {
timeLogger.finer(System.currentTimeMillis() + " : " + note);
}
}
if (pm == null) {
@@ -71,8 +70,8 @@ public class Utils {
String filename = grammarsDir + File.separator + GFEditor2.modelModulName + endings[i];
File file = new File(filename);
file.deleteOnExit();
if (deleteLogger.isDebugEnabled()) {
deleteLogger.debug("scheduled for deletion: " + filename);
if (deleteLogger.isLoggable(Level.FINER)) {
deleteLogger.fine("scheduled for deletion: " + filename);
}
}
File file = new File(grammarsDir);
@@ -95,13 +94,13 @@ public class Utils {
* Only gets called in stand-alone mode, not when run with KeY.
*/
public static void configureLogger() {
if ((new File(LOGGER_CONFIGURATION)).exists())
org.apache.log4j.PropertyConfigurator.configureAndWatch(
LOGGER_CONFIGURATION, 1500);
else {
org.apache.log4j.BasicConfigurator.configure();
Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR);
}
// if ((new File(LOGGER_CONFIGURATION)).exists())
// org.apache.log4j.PropertyConfigurator.configureAndWatch(
// LOGGER_CONFIGURATION, 1500);
// else {
// org.apache.log4j.BasicConfigurator.configure();
// Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR);
// }
}
/**