diff --git a/org/postgresql/ds/common/BaseDataSource.java b/org/postgresql/ds/common/BaseDataSource.java index bfe54f7..2aa7b31 100644 --- a/org/postgresql/ds/common/BaseDataSource.java +++ b/org/postgresql/ds/common/BaseDataSource.java @@ -63,6 +63,7 @@ private int logLevel = 0; private int protocolVersion = 0; private String applicationName; + private boolean logLevelIsSet = false; /** * Gets a connection to the PostgreSQL database. The database is identified by the @@ -184,6 +185,7 @@ public void setLogLevel(int logLevel) { this.logLevel = logLevel; + logLevelIsSet = true; } public int getProtocolVersion() @@ -486,7 +488,9 @@ sb.append("&socketTimeout=").append(socketTimeout); sb.append("&prepareThreshold=").append(prepareThreshold); sb.append("&unknownLength=").append(unknownLength); - sb.append("&loglevel=").append(logLevel); + if (logLevelIsSet) { + sb.append("&loglevel=").append(logLevel); + } if (protocolVersion != 0) { sb.append("&protocolVersion=").append(protocolVersion); } @@ -562,7 +566,10 @@ ref.add(new StringRefAddr("compatible", compatible)); } - ref.add(new StringRefAddr("logLevel", Integer.toString(logLevel))); + if(logLevelIsSet) + { + ref.add(new StringRefAddr("logLevel", Integer.toString(logLevel))); + } ref.add(new StringRefAddr("protocolVersion", Integer.toString(protocolVersion))); ref.add(new StringRefAddr("ApplicationName", applicationName)); @@ -592,6 +599,7 @@ out.writeBoolean(binaryTransfer); out.writeObject(binaryTransferEnable); out.writeObject(binaryTransferDisable); + out.writeBoolean(logLevelIsSet); } protected void readBaseObject(ObjectInputStream in) throws IOException, ClassNotFoundException @@ -617,6 +625,7 @@ binaryTransfer = in.readBoolean(); binaryTransferEnable = (String)in.readObject(); binaryTransferDisable = (String)in.readObject(); + logLevelIsSet = in.readBoolean(); } public void initializeFrom(BaseDataSource source) throws IOException, ClassNotFoundException {