Skip to content

Commit

Permalink
Log the send and received PDU's at debug log level. Remove the space …
Browse files Browse the repository at this point in the history
…to condense the output.
  • Loading branch information
pmoerenhout committed Oct 19, 2020
1 parent a0b9a47 commit 0bfeda2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
5 changes: 2 additions & 3 deletions jsmpp/src/main/java/org/jsmpp/DefaultPDUSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,9 @@ public byte[] sendAlertNotification(OutputStream os, int sequenceNumber,

private static void writeAndFlush(OutputStream out, byte[] b)
throws IOException {
if(logger.isDebugEnabled())
if (logger.isDebugEnabled())
{
String hexmsg = HexUtil.convertBytesToHexString(b, 0, b.length, " ");
logger.debug("Sending SMPP message {}", hexmsg);
logger.debug("Sending PDU {}", HexUtil.convertBytesToHexString(b, 0, b.length));
}
out.write(b);
out.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
package org.jsmpp.session;

import static org.jsmpp.SMPPConstant.PDU_HEADER_LENGTH;

import java.io.IOException;

import org.jsmpp.SMPPConstant;
Expand Down Expand Up @@ -53,8 +51,7 @@ class PDUProcessOutboundServerTask implements Runnable {
public void run() {
try {
if (logger.isDebugEnabled()) {
logger.debug("Received SMPP message {} {}", pduHeader,
HexUtil.convertBytesToHexString(pdu, PDU_HEADER_LENGTH, pdu.length, " "));
logger.debug("Received PDU {}", HexUtil.convertBytesToHexString(pdu, 0, pdu.length));
}

switch (pduHeader.getCommandId()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ class PDUProcessOutboundTask implements Runnable {
@Override
public void run() {
try {
if(logger.isDebugEnabled()) {
logger.debug("Received SMPP message {} {}", pduHeader,
HexUtil.convertBytesToHexString(pdu, 16, pdu.length, " "));
if (logger.isDebugEnabled()) {
logger.debug("Received PDU {}", HexUtil.convertBytesToHexString(pdu, 0, pdu.length));
}

switch (pduHeader.getCommandId()) {
Expand Down
16 changes: 8 additions & 8 deletions jsmpp/src/main/java/org/jsmpp/session/PDUProcessServerTask.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.jsmpp.session;

Expand Down Expand Up @@ -52,11 +52,11 @@ public PDUProcessServerTask(Command pduHeader, byte[] pdu,
@Override
public void run() {
try {
if(logger.isDebugEnabled())
if (logger.isDebugEnabled())
{
String hexmsg = HexUtil.convertBytesToHexString(pdu, 0, pdu.length, " ");
logger.debug("Received SMPP message {} {}", pduHeader, hexmsg);
logger.debug("Received PDU {}", HexUtil.convertBytesToHexString(pdu, 0, pdu.length));
}

switch (pduHeader.getCommandId()) {
case SMPPConstant.CID_BIND_RECEIVER:
case SMPPConstant.CID_BIND_TRANSMITTER:
Expand Down
7 changes: 2 additions & 5 deletions jsmpp/src/main/java/org/jsmpp/session/PDUProcessTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
package org.jsmpp.session;

import static org.jsmpp.SMPPConstant.PDU_HEADER_LENGTH;

import java.io.IOException;

import org.jsmpp.SMPPConstant;
Expand Down Expand Up @@ -52,9 +50,8 @@ public PDUProcessTask(Command pduHeader, byte[] pdu,
@Override
public void run() {
try {
if(logger.isDebugEnabled()) {
logger.debug("Received SMPP message {} {}", pduHeader,
HexUtil.convertBytesToHexString(pdu, PDU_HEADER_LENGTH, pdu.length, " "));
if (logger.isDebugEnabled()) {
logger.debug("Received PDU {}", HexUtil.convertBytesToHexString(pdu, 0, pdu.length));
}

switch (pduHeader.getCommandId()) {
Expand Down

0 comments on commit 0bfeda2

Please sign in to comment.