Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gunlee01 committed May 15, 2016
1 parent be5007f commit 6ab7c79
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions scouter.agent.java/src/scouter/agent/Configure.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ public final static synchronized Configure getInstance() {
public String log_dir ="";
public boolean log_rotation_enabled =true;
public int log_keep_days =7;
public boolean _log_trace_enabled = false;
public boolean _log_trace_use_logger = false;
public boolean _trace = false;
public boolean _trace_use_logger = false;

//Hook
public String hook_args_patterns = "";
Expand Down Expand Up @@ -505,8 +505,8 @@ private void apply() {
this.log_dir = getValue("log_dir", "");
this.log_rotation_enabled = getBoolean("log_rotation_enabled", true);
this.log_keep_days = getInt("log_keep_days", 7);
this._log_trace_enabled = getBoolean("_log_trace_enabled", false);
this._log_trace_use_logger = getBoolean("_log_trace_use_logger", false);
this._trace = getBoolean("_trace", false);
this._trace_use_logger = getBoolean("_trace_use_logger", false);

this.enduser_trace_endpoint_url = getValue("enduser_trace_endpoint_url", "_scouter_browser.jsp");
this.enduser_perf_endpoint_hash = HashUtil.hash(this.enduser_trace_endpoint_url);
Expand Down
4 changes: 2 additions & 2 deletions scouter.agent.java/src/scouter/agent/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static void println(String id, String message, Throwable t) {
}

public static void trace(Object message) {
if(conf._log_trace_enabled) {
if(conf._log_trace_use_logger) {
if(conf._trace) {
if(conf._trace_use_logger) {
println(build("SCOUTER-TRC", toString(message)), true);
} else {
System.out.println(build("SCOUTER-TRC", toString(message)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
public class ServicePerf {

private MeterResource activeCounter = new MeterResource();
private Configure conf = Configure.getInstance();

@Counter
public void getServicePerf(CounterBasket pw) {
Expand Down Expand Up @@ -108,6 +109,11 @@ public void getServicePerf(CounterBasket pw) {
public void summay(CounterBasket pw) {
long time = System.currentTimeMillis();
long now = DateUtil.getMinUnit(time) / 5;

if(conf.getBoolean("_dev_summary_test", false)) {
now = time / 1000 / 15;
}

if (now == last_sent)
return;
last_sent = now;
Expand Down
2 changes: 1 addition & 1 deletion scouter.agent.java/src/scouter/agent/trace/TraceSQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static void end(Object stat, Throwable thr, int updatedCount) {
LocalContext lCtx = (LocalContext) stat;
TraceContext tCtx = lCtx.context;

Logger.trace("affected row = " + updatedCount);
//Logger.trace("affected row = " + updatedCount);

SqlStep3 step = (SqlStep3) lCtx.stepSingle;
tCtx.lastSqlStep = step;
Expand Down
2 changes: 1 addition & 1 deletion scouter.agent.java/src/scouter/agent/util/AsyncRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void alert(LeakInfo2 leakInfo2) {
}
DataProxy.sendAlert(AlertLevel.WARN, "CONNECTION_NOT_CLOSE", "Connection may not closed", mv);

if(conf._log_trace_enabled) Logger.trace("[Force-Close-InnerObject]" + System.identityHashCode(leakInfo2.innerObject));
if(conf._trace) Logger.trace("[Force-Close-InnerObject]" + System.identityHashCode(leakInfo2.innerObject));

boolean closeResult = leakInfo2.closeManager.close(leakInfo2.innerObject);
//Logger.println("G003", "connection auto closed:" + closeResult);
Expand Down

0 comments on commit 6ab7c79

Please sign in to comment.