[openrtm-commit:00987] r685 - in trunk/jp.go.aist.rtm.RTC: src/jp/go/aist/rtm/RTC src/jp/go/aist/rtm/RTC/log src/jp/go/aist/rtm/RTC/util src/jp/go/aist/rtm/RTC/util/clock tests/src/jp/go/aist/rtm/RTC/log tests/src/jp/go/aist/rtm/RTC/util
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 2月 6日 (水) 13:57:23 JST
Author: ga
Date: 2013-02-06 13:57:23 +0900 (Wed, 06 Feb 2013)
New Revision: 685
Added:
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/ClockManager.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/IClock.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java
trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java
Modified:
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java
trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogbufTest.java
trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/TimeValueTest.java
Log:
ClockManager have been implemented. refs #2356
Modified to use ClockManager in Logger. refs #2359
Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2013-02-03 04:17:17 UTC (rev 684)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -232,6 +232,24 @@
}
/**
+ * {@.ja マネージャインスタンスが生成済みかチェック。}
+ * {@.en Check Manager Instance}
+ *
+ * <p>
+ * {@.ja マネージャインスタンスが生成済みかどうか確認する。}
+ * {@.en Check manager instance}
+ *
+ * @return
+ * {@.ja Manager の唯一のインスタンスの有無}
+ * {@.en Existence of the only instance reference of the manager}
+ */
+ public static boolean isActive() {
+ if(manager==null)
+ return false;
+ return true;
+ }
+
+ /**
* {@.ja マネージャ・シャットダウン}
* {@.en Shutdown Manager}
*
@@ -2075,6 +2093,8 @@
// Set date format for log entry header
rtcout.setDateFormat(m_config.getProperty("logger.date_format"));
+ rtcout.setClockType(m_config.getProperty("logger.clock_type"));
+
// Loglevel was set from configuration file.
rtcout.setLevel(m_config.getProperty("logger.log_level"));
Modified: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java 2013-02-03 04:17:17 UTC (rev 684)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -9,6 +9,12 @@
import java.util.logging.LogRecord;
import java.util.logging.Logger;
+import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.util.TimeValue;
+import jp.go.aist.rtm.RTC.util.clock.ClockManager;
+import jp.go.aist.rtm.RTC.util.clock.IClock;
+import jp.go.aist.rtm.RTC.util.clock.LogicalClock;
+
/**
* <p>ログ収集ON時のロギングクラスです。</p>
* ログ出力の可否は、デフォルトで無効とし、
@@ -47,16 +53,28 @@
public Logbuf(String name) {
m_LogLock = false;
m_Suffix = name;
+ m_clock = ClockManager.getInstance().getClock("system");
+ if(Manager.isActive() ) {
+ if( Manager.instance().getConfig().getNode("logger.date_format")!=null ) {
+ setDateFormat(Manager.instance().getConfig().getProperty("logger.date_format"));
+ }
+ if( Manager.instance().getConfig().getNode("logger.clock_type")!=null ) {
+ setClockType(Manager.instance().getConfig().getProperty("logger.clock_type"));
+ }
+ }
+
int parent = name.indexOf("Manager.");
String str;
if(name.equals("Manager")) {
str = "OpenRTM-aist.logging." + name;
m_Logger = Logger.getLogger(str);
this.addStream(new NullHandler());
+
} else if(parent >= 0) {
m_Suffix = this.getLastName(name);
str = "OpenRTM-aist.logging.Manager." + m_Suffix;
m_Logger = Logger.getLogger(str);
+
} else {
str = "OpenRTM-aist.logging.Manager." + name;
m_Logger = Logger.getLogger(str);
@@ -80,6 +98,16 @@
public Logbuf(String name, String parent) {
m_LogLock = false;
m_Suffix = name;
+ m_clock = ClockManager.getInstance().getClock("system");
+ if(Manager.isActive() ) {
+ if( Manager.instance().getConfig().getNode("logger.date_format")!=null ) {
+ setDateFormat(Manager.instance().getConfig().getProperty("logger.date_format"));
+ }
+ if( Manager.instance().getConfig().getNode("logger.clock_type")!=null ) {
+ setClockType(Manager.instance().getConfig().getProperty("logger.clock_type"));
+ }
+ }
+
String str;
if((parent.length() == 0) || (parent == null)) {
str = "OpenRTM-aist.logging." + name;
@@ -119,20 +147,30 @@
// System.err.println("Logbuf.println() destination handler was not registered.");
return;
}
- StringBuilder sb = new StringBuilder();
+// StringBuilder sb = new StringBuilder();
+//
+// // Send all output to the Appendable object sb
+// java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
+//
+// // Explicit argument indices may be used to re-order output.
+// Date date = new Date();
- // Send all output to the Appendable object sb
- java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
-
- // Explicit argument indices may be used to re-order output.
- Date date = new Date();
-
String str = logLevelToStr(level);
Level clevel = Level.parse(str);
- m_Logger.log(clevel,
- formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date)
- + " " + m_Suffix + " " + logLevelToStr(level) + " " + contents);
+// m_Logger.log(clevel,
+// formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date)
+// + " " + m_Suffix + " " + logLevelToStr(level) + " " + contents);
+ m_Logger.log(clevel, getDate() + " " + m_Suffix + " " + logLevelToStr(level) + " " + contents);
}
+
+ protected String getDate() {
+ //桁落ちを防ぐために微少値を加算
+ long sec = (long)(m_clock.getTime().toDouble()*1000+0.0000005);
+ Date date = new Date(sec);
+ StringBuilder sb = new StringBuilder();
+ java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
+ return formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date).toString();
+ }
/**
* <p>RTM用ログレベルの設定</p>
@@ -408,6 +446,45 @@
}
/**
+ * {@.ja ログ記録時に使用するクロックを指定する}
+ * {@.en Specifying clock type to be used for logging}
+ *
+ * <p>
+ * {@.ja ログ記録時に時刻を取得するためのクロックの種類を指定することができる。
+ * <li> system: システムクロック。デフォルト
+ * <li> logical: 論理時間クロック。
+ * <li> adjusted: 調整済みクロック。
+ * <li> initTimer: Timer 初期化</li>
+ * 論理時間クロックについては
+ * <pre>
+ * ClockManager::instance().getClock("logical").settime()
+ * </pre>
+ * で時刻を設定する必要がある。
+ *
+ * {@.en This function sets a clock type getting time when it is used
+ * for logging. Available clock types are,
+ * <li> system: System clock. Default option.
+ * <li> logical: Logical time clock.
+ * <li> adjusted: Adjusted clock.
+ * To use logical time clock, call and set time by the following
+ * function in somewhere.
+ * <pre>
+ * coil::ClockManager::instance().getClock("logical").settime()
+ * </pre>}
+ *
+ * @param clocktype
+ * {@.ja 上述のクロックタイプ}
+ * {@.en A clock type above mentioned.}
+ */
+ public void setClockType(String clocktype) {
+ m_clock = ClockManager.getInstance().getClock(clocktype);
+ //論理時間の場合は出力書式のデフォルト設定を変更
+ if(m_clock instanceof LogicalClock) {
+ setDateFormat("%S %L");
+ }
+ }
+
+ /**
* <p>ログ・レベルを設定します。</p>
*
* @param level ログ・レベル
@@ -453,6 +530,8 @@
* <p>出力先ハンドラの数</p>
*/
private int m_HandlerCount = 0;
+
+ private IClock m_clock;
/**
* <p>ログ出力の設定</p>
Added: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -0,0 +1,42 @@
+package jp.go.aist.rtm.RTC.util.clock;
+
+import jp.go.aist.rtm.RTC.util.TimeValue;
+
+/**
+ * {@.ja 調整済み時刻を扱うクロックオブジェクト}
+ * {@.en Clock object to handle adjusted clock}
+ *
+ * <p>
+ * {@.ja settime() 呼び出し時に現在時刻との差をオフセットとして保持し、
+ * gettime() によってオフセット調整済みの時刻を返す。}
+ * {@.en This class stores a offset time with current system clock when
+ * settime(), and gettime() returns adjusted clock by the offset.}
+ */
+public class AdjustedClock implements IClock {
+ private TimeValue m_offset;
+
+ public AdjustedClock() {
+ m_offset = new TimeValue(0.0);
+ }
+
+ public TimeValue getTime() {
+ synchronized (m_offset) {
+ long msec = System.currentTimeMillis();
+ long sec = msec/1000;
+ long usec = (msec - sec*1000)*1000;
+ TimeValue base = new TimeValue(sec, usec);
+ return base.minus(m_offset);
+ }
+ }
+
+ public boolean setTime(TimeValue clocktime) {
+ synchronized (m_offset) {
+ long msec = System.currentTimeMillis();
+ long sec = msec/1000;
+ long usec = (msec - sec*1000)*1000;
+ TimeValue base = new TimeValue(sec, usec);
+ m_offset = base.minus(clocktime);
+ }
+ return true;
+ }
+}
Added: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/ClockManager.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/ClockManager.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/ClockManager.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -0,0 +1,42 @@
+package jp.go.aist.rtm.RTC.util.clock;
+
+/**
+ * {@.ja グローバルなクロック管理クラス。}
+ * {@.en A global clock management class}
+ *
+ * <p>
+ * {@.ja このクラスはグローバルにクロックオブジェクトを提供するシングルトン
+ * クラスである。getClocK(クロック名) により IClock 型のクロックオブ
+ * ジェクトを返す。利用可能なクロックは "system", "logical" および
+ * "adjusted" の3種類である。}
+ * {@.en This class is a singleton class that provides clock objects
+ * globally. It provides a IClock object by getClock(<clock
+ * type>). As clock types, "system", "logical" and "adjusted" are
+ * available.}
+ */
+public class ClockManager {
+
+ private static ClockManager __instance = new ClockManager();
+
+ public static ClockManager getInstance() {
+ return __instance;
+ }
+
+ public IClock getClock(String clocktype) {
+ if( clocktype.equals("logical") ) {
+ return m_logicalClock;
+ } else if (clocktype.equals("adjusted") ) {
+ return m_adjustedClock;
+ } else {
+ return m_systemClock;
+ }
+ }
+
+ private ClockManager() {
+ }
+
+ private SystemClock m_systemClock = new SystemClock();
+ private LogicalClock m_logicalClock = new LogicalClock();
+ private AdjustedClock m_adjustedClock = new AdjustedClock();
+
+}
Added: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/IClock.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/IClock.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/IClock.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -0,0 +1,45 @@
+package jp.go.aist.rtm.RTC.util.clock;
+
+import jp.go.aist.rtm.RTC.util.TimeValue;
+
+/**
+ * {@.ja 時刻設定・取得オブジェクトのインターフェース}
+ * {@.en An interface to set and get time}
+ *
+ * <p>
+ * {@.ja このクラスは ClockManager によって管理されるクロックオブジェクトの
+ * ためのインターフェースである。ClockManager は複数のクロックオブジェ
+ * クトを管理し、必要に応じて適切なクロックオブジェクトを IClock イン
+ * ターフェースをもつオブジェクトとして返す。クロックオブジェクトは単
+ * にシステム時刻を返すものや、独自の論理時刻を持つクロックオブジェク
+ * ト等が考えられる。}
+ * {@.en This class is a interface for clock objects managed by
+ * ClockManager. ClockManager manages one or more clocks, and it
+ * returns appropriate clock objects according to demands. The clock
+ * object might be clock which just returns system time, or a clock
+ * which returns individual logical time.}
+ */
+public interface IClock {
+
+ /**
+ * {@.ja 時刻を取得する}
+ * {@.en Getting time}
+ *
+ * @return
+ * {@.ja 現在の時刻}
+ * {@.en Current time}
+ *
+ */
+ public TimeValue getTime();
+
+ /**
+ * {@.ja 時刻を設定する}
+ * {@.en Setting time}
+ *
+ * @param clocktime
+ * {@.ja 現在の時刻}
+ * {@.en clocktime Current time}
+ *
+ */
+ public boolean setTime(TimeValue clocktime);
+}
Added: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/LogicalClock.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -0,0 +1,36 @@
+package jp.go.aist.rtm.RTC.util.clock;
+
+import jp.go.aist.rtm.RTC.util.TimeValue;
+
+/**
+ * {@.ja 論理時間を扱うクロックオブジェクト}
+ * {@.en Clock object to handle logical clock}
+ *
+ * <p>
+ * {@.ja このクラスは論理時間を設定または取得するクラスである。
+* 単純に settime() によって設定された時刻を gettime() によって取得する。}
+ * {@.en This class sets and gets system clock.
+ * It just sets time by settime() and gets time by gettime().}
+ */
+public class LogicalClock implements IClock {
+
+ private TimeValue m_currentTime;
+
+ public LogicalClock() {
+ m_currentTime = new TimeValue(0.0);
+ }
+
+ public TimeValue getTime() {
+ synchronized (m_currentTime) {
+ return m_currentTime;
+ }
+ }
+
+ public boolean setTime(TimeValue clocktime) {
+ synchronized (m_currentTime) {
+ m_currentTime = clocktime;
+ }
+ return true;
+ }
+
+}
Added: trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -0,0 +1,27 @@
+package jp.go.aist.rtm.RTC.util.clock;
+
+import jp.go.aist.rtm.RTC.util.TimeValue;
+
+/**
+ * {@.ja システム時刻を扱うクロックオブジェクト}
+ * {@.en clock object to handle system clock}
+ *
+ * <p>
+ * {@.ja このクラスはシステムクロックを設定または取得するクラスである。}
+ * {@.en This class sets and gets system clock.}
+ */
+public class SystemClock implements IClock {
+
+ public TimeValue getTime() {
+ long msec = System.currentTimeMillis();
+ long sec = msec/1000;
+ long usec = (msec - sec*1000)*1000;
+ TimeValue base = new TimeValue(sec, usec);
+ return base;
+ }
+
+ public boolean setTime(TimeValue clocktime) {
+ return false;
+ }
+
+}
Modified: trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogbufTest.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogbufTest.java 2013-02-03 04:17:17 UTC (rev 684)
+++ trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogbufTest.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -1,16 +1,15 @@
package jp.go.aist.rtm.RTC.log;
-import junit.framework.TestCase;
-
import java.io.BufferedReader;
-import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
-import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
-import jp.go.aist.rtm.RTC.log.Logbuf;
import jp.go.aist.rtm.RTC.Manager;
+import junit.framework.TestCase;
/**
*
@@ -40,60 +39,74 @@
// STDOUT
// Junit出力ファイル*.xmlの <system-err>の欄に出力される
System.err.println("\n\n--- test_case0() setLevel() Not Set ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT 0");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT 0");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT 0");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT 0");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT 0");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT 0");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT 0");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT 0");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT 0");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 0");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 0");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 0");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 0");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 0");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 0");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 0");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 0");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 0");
// addStream()していないので、printlnの文字列が出力されなければOK.
// "Logbuf.println() destination handler was not registered."の出力あればOK.
rtcout.setLevel("PARANOID"); //全て
System.err.println("--- test_case0() setLevel(PARANOID), addStream(STDOUT) Not set ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT 1");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT 1");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT 1");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT 1");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT 1");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT 1");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT 1");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT 1");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT 1");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 1");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 1");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 1");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 1");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 1");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 1");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 1");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 1");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 1");
// addStream()していないので、printlnの文字列が出力されなければOK.
// "Logbuf.println() destination handler was not registered."の出力あればOK.
- rtcout.addStream(new ConsoleHandler());
+ LocalHandler handler = new LocalHandler();
+ rtcout.addStream(handler);
+ rtcout.setClockType("logical");
+// rtcout.addStream(new ConsoleHandler());
System.err.println("--- test_case0() addStream(STDOUT) set ---");
rtcout.setDisabled();
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT 2");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT 2");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT 2");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT 2");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT 2");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT 2");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT 2");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT 2");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT 2");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 2");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 2");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 2");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 2");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 2");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 2");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 2");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 2");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 2");
// 何も出力されなければOK.
+ String expected = "";
+ assertEquals(expected, handler.getStr());
rtcout.setEnabled();
System.err.println("--- test_case0() addStream(STDOUT) set ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT 2");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT 2");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT 2");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT 2");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT 2");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT 2");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT 2");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT 2");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT 2");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 2");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 2");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 2");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 2");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 2");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 2");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 2");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 2");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 2");
// setLevel()以下の内容が、出力されればOK.
-
+ expected = "00 000 test0 PARANOID : PARANOID string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 VERBOSE : VERBOSE string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 TRACE : TRACE string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 DEBUG : DEBUG string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 INFO : INFO string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 WARN : WARN string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 ERROR : ERROR string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 FATAL : FATAL string to STDOUT 2" + System.getProperty("line.separator") +
+ "00 000 test0 SILENT : SILENT string to STDOUT 2" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
}
/**
@@ -106,138 +119,212 @@
rtcout.setEnabled();
// STDOUT
- // Junit出力ファイル*.xmlの <system-err>の欄に出力される
- rtcout.addStream(new ConsoleHandler());
+// // Junit出力ファイル*.xmlの <system-err>の欄に出力される
+// rtcout.addStream(new ConsoleHandler());
+ rtcout.setEnabled();
+ rtcout.setClockType("logical");
+ rtcout.setLevel("PARANOID");
+ LocalHandler handler = new LocalHandler();
+ rtcout.addStream(handler);
rtcout.setLevel("PARANOID");
- System.err.println("\n\n--- setLevel:PARANOID check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ String expected =
+ "00 000 test1 PARANOID : PARANOID string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 VERBOSE : VERBOSE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 TRACE : TRACE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("VERBOSE");
- System.err.println("--- setLevel:VERBOSE check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 VERBOSE : VERBOSE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 TRACE : TRACE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("TRACE");
- System.err.println("--- setLevel:TRACE check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 TRACE : TRACE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("DEBUG");
System.err.println("--- setLevel:DEBUG check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("INFO");
- System.err.println("--- setLevel:INFO check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("WARN");
System.err.println("--- setLevel:WARN check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("ERROR");
System.err.println("--- setLevel:ERROR check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("FATAL");
System.err.println("--- setLevel:FATAL check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test1 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test1 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("SILENT");
System.err.println("--- setLevel:SILENT check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// 何も出力されなければOK.
+ expected = "";
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel("other");
System.err.println("--- setLevel:other check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// 何も出力されなければOK.
+ expected = "";
+ assertEquals(expected, handler.getStr());
}
@@ -251,139 +338,207 @@
rtcout.setEnabled();
// STDOUT
- // Junit出力ファイル*.xmlの <system-err>の欄に出力される
- rtcout.addStream(new ConsoleHandler());
+// // Junit出力ファイル*.xmlの <system-err>の欄に出力される
+// rtcout.addStream(new ConsoleHandler());
+ rtcout.setEnabled();
+ rtcout.setClockType("logical");
+ rtcout.setLevel("PARANOID");
+ LocalHandler handler = new LocalHandler();
+ rtcout.addStream(handler);
- rtcout.setLevel(rtcout.PARANOID);
- System.err.println("\n\n--- setLevel:int PARANOID check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.setLevel(Logbuf.PARANOID);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ String expected =
+ "00 000 test2 PARANOID : PARANOID string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 VERBOSE : VERBOSE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 TRACE : TRACE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.VERBOSE);
- System.err.println("--- setLevel:int VERBOSE check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.VERBOSE);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 VERBOSE : VERBOSE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 TRACE : TRACE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.TRACE);
- System.err.println("--- setLevel:int TRACE check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.TRACE);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 TRACE : TRACE string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.DEBUG);
- System.err.println("--- setLevel:int DEBUG check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.DEBUG);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 DEBUG : DEBUG string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.INFO);
- System.err.println("--- setLevel:int INFO check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.INFO);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 INFO : INFO string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.WARN);
- System.err.println("--- setLevel:int WARN check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.WARN);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 WARN : WARN string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.ERROR);
- System.err.println("--- setLevel:int ERROR check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.ERROR);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 ERROR : ERROR string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.FATAL);
- System.err.println("--- setLevel:int FATAL check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.FATAL);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// setLevel()以下の内容が、出力されればOK.
+ expected =
+ "00 000 test2 FATAL : FATAL string to STDOUT" + System.getProperty("line.separator") +
+ "00 000 test2 SILENT : SILENT string to STDOUT" + System.getProperty("line.separator");
+ assertEquals(expected, handler.getStr());
- rtcout.setLevel(rtcout.SILENT);
- System.err.println("--- setLevel:int SILENT check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ handler.clear();
+ rtcout.setLevel(Logbuf.SILENT);
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// 何も出力されなければOK.
+ expected = "";
+ assertEquals(expected, handler.getStr());
+ handler.clear();
rtcout.setLevel(999);
- System.err.println("--- setLevel:int 999 check ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string to STDOUT");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to STDOUT");
- rtcout.println(rtcout.TRACE, "TRACE string to STDOUT");
- rtcout.println(rtcout.DEBUG, "DEBUG string to STDOUT");
- rtcout.println(rtcout.INFO, "INFO string to STDOUT");
- rtcout.println(rtcout.WARN, "WARN string to STDOUT");
- rtcout.println(rtcout.ERROR, "ERROR string to STDOUT");
- rtcout.println(rtcout.FATAL, "FATAL string to STDOUT");
- rtcout.println(rtcout.SILENT, "SILENT string to STDOUT");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT");
// 何も出力されなければOK.
-
+ expected = "";
+ assertEquals(expected, handler.getStr());
+
}
/**
@@ -407,15 +562,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("PARANOID");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -464,15 +619,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("VERBOSE");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -521,15 +676,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("TRACE");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -577,15 +732,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("DEBUG");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -633,15 +788,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("INFO");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -689,15 +844,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("WARN");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -745,15 +900,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("ERROR");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -801,15 +956,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("FATAL");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -857,15 +1012,15 @@
System.err.println("Error: cannot open logfile: " + logfile );
}
rtcout.setLevel("SILENT");
- rtcout.println(rtcout.PARANOID, "PARANOID string to rtc.log");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string to rtc.log");
- rtcout.println(rtcout.TRACE, "TRACE string to rtc.log");
- rtcout.println(rtcout.DEBUG, "DEBUG string to rtc.log");
- rtcout.println(rtcout.INFO, "INFO string to rtc.log");
- rtcout.println(rtcout.WARN, "WARN string to rtc.log");
- rtcout.println(rtcout.ERROR, "ERROR string to rtc.log");
- rtcout.println(rtcout.FATAL, "FATAL string to rtc.log");
- rtcout.println(rtcout.SILENT, "SILENT string to rtc.log");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to rtc.log");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to rtc.log");
+ rtcout.println(Logbuf.TRACE, "TRACE string to rtc.log");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to rtc.log");
+ rtcout.println(Logbuf.INFO, "INFO string to rtc.log");
+ rtcout.println(Logbuf.WARN, "WARN string to rtc.log");
+ rtcout.println(Logbuf.ERROR, "ERROR string to rtc.log");
+ rtcout.println(Logbuf.FATAL, "FATAL string to rtc.log");
+ rtcout.println(Logbuf.SILENT, "SILENT string to rtc.log");
//ファイル出力の確認
int cnt = 0;
@@ -905,35 +1060,35 @@
rtcout.setLevel("PARANOID");
int lv = 0;
- lv = rtcout.strToLogLevel("SILENT");
- assertEquals(rtcout.SILENT, lv);
+ lv = Logbuf.strToLogLevel("SILENT");
+ assertEquals(Logbuf.SILENT, lv);
- lv = rtcout.strToLogLevel("FATAL");
- assertEquals(rtcout.FATAL, lv);
+ lv = Logbuf.strToLogLevel("FATAL");
+ assertEquals(Logbuf.FATAL, lv);
- lv = rtcout.strToLogLevel("ERROR");
- assertEquals(rtcout.ERROR, lv);
+ lv = Logbuf.strToLogLevel("ERROR");
+ assertEquals(Logbuf.ERROR, lv);
- lv = rtcout.strToLogLevel("WARN");
- assertEquals(rtcout.WARN, lv);
+ lv = Logbuf.strToLogLevel("WARN");
+ assertEquals(Logbuf.WARN, lv);
- lv = rtcout.strToLogLevel("INFO");
- assertEquals(rtcout.INFO, lv);
+ lv = Logbuf.strToLogLevel("INFO");
+ assertEquals(Logbuf.INFO, lv);
- lv = rtcout.strToLogLevel("DEBUG");
- assertEquals(rtcout.DEBUG, lv);
+ lv = Logbuf.strToLogLevel("DEBUG");
+ assertEquals(Logbuf.DEBUG, lv);
- lv = rtcout.strToLogLevel("TRACE");
- assertEquals(rtcout.TRACE, lv);
+ lv = Logbuf.strToLogLevel("TRACE");
+ assertEquals(Logbuf.TRACE, lv);
- lv = rtcout.strToLogLevel("VERBOSE");
- assertEquals(rtcout.VERBOSE, lv);
+ lv = Logbuf.strToLogLevel("VERBOSE");
+ assertEquals(Logbuf.VERBOSE, lv);
- lv = rtcout.strToLogLevel("PARANOID");
- assertEquals(rtcout.PARANOID, lv);
+ lv = Logbuf.strToLogLevel("PARANOID");
+ assertEquals(Logbuf.PARANOID, lv);
- lv = rtcout.strToLogLevel("other");
- assertEquals(rtcout.SILENT, lv);
+ lv = Logbuf.strToLogLevel("other");
+ assertEquals(Logbuf.SILENT, lv);
System.err.println("--- test_strToLogLevel() is OK ---");
}
@@ -955,14 +1110,14 @@
// "logger.date_format", "%b %d %H:%M:%S",
format = "%b %d %H:%M:%S";
rtcout.setDateFormat(format);
- rtcout.println(rtcout.TRACE, "DateFormat Month day HH:MI:SS");
+ rtcout.println(Logbuf.TRACE, "DateFormat Month day HH:MI:SS");
// Junit出力ファイル*.xmlの <system-err>の欄に出力される
// 日付と時刻のパターンが、Month day hh:mi:ss であれがOK
//Sep 29 16:36:53 TEST1 TRACE : TRACE string to rtc.log
format = "%Y/%m/%d %p %I:%M:%S";
rtcout.setDateFormat(format);
- rtcout.println(rtcout.TRACE, "DateFormat YYYY/MM/DD pp II:MI:SS");
+ rtcout.println(Logbuf.TRACE, "DateFormat YYYY/MM/DD pp II:MI:SS");
// Junit出力ファイル*.xmlの <system-err>の欄に出力される
// 日付と時刻のパターンが、YYYY/MM/DD pp II:MI:SS であれがOK
@@ -1008,75 +1163,75 @@
rtcout.setLevel("INFO");
System.err.println("--- Logbuf(Manager) set ---");
- rtcout.println(rtcout.INFO, "--- setLevel(INFO), addStream(STDOUT) set ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string 1");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string 1");
- rtcout.println(rtcout.TRACE, "TRACE string 1");
- rtcout.println(rtcout.DEBUG, "DEBUG string 1");
- rtcout.println(rtcout.INFO, "INFO string 1");
- rtcout.println(rtcout.WARN, "WARN string 1");
- rtcout.println(rtcout.ERROR, "ERROR string 1");
- rtcout.println(rtcout.FATAL, "FATAL string 1");
- rtcout.println(rtcout.SILENT, "SILENT string 1");
+ rtcout.println(Logbuf.INFO, "--- setLevel(INFO), addStream(STDOUT) set ---");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string 1");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string 1");
+ rtcout.println(Logbuf.TRACE, "TRACE string 1");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string 1");
+ rtcout.println(Logbuf.INFO, "INFO string 1");
+ rtcout.println(Logbuf.WARN, "WARN string 1");
+ rtcout.println(Logbuf.ERROR, "ERROR string 1");
+ rtcout.println(Logbuf.FATAL, "FATAL string 1");
+ rtcout.println(Logbuf.SILENT, "SILENT string 1");
// setLevel(INFO)以下の内容が、出力されればOK.
Logbuf rtcout2 = new Logbuf("Manager.hoge1");
rtcout2.setEnabled();
System.err.println("--- Logbuf(Manager.hoge1) set ---");
- rtcout2.println(rtcout2.INFO, "--- setLevel(INFO) Not set ---");
- rtcout2.println(rtcout2.PARANOID, "PARANOID string 2");
- rtcout2.println(rtcout2.VERBOSE, "VERBOSE string 2");
- rtcout2.println(rtcout2.TRACE, "TRACE string 2");
- rtcout2.println(rtcout2.DEBUG, "DEBUG string 2");
- rtcout2.println(rtcout2.INFO, "INFO string 2");
- rtcout2.println(rtcout2.WARN, "WARN string 2");
- rtcout2.println(rtcout2.ERROR, "ERROR string 2");
- rtcout2.println(rtcout2.FATAL, "FATAL string 2");
- rtcout2.println(rtcout2.SILENT, "SILENT string 2");
+ rtcout2.println(Logbuf.INFO, "--- setLevel(INFO) Not set ---");
+ rtcout2.println(Logbuf.PARANOID, "PARANOID string 2");
+ rtcout2.println(Logbuf.VERBOSE, "VERBOSE string 2");
+ rtcout2.println(Logbuf.TRACE, "TRACE string 2");
+ rtcout2.println(Logbuf.DEBUG, "DEBUG string 2");
+ rtcout2.println(Logbuf.INFO, "INFO string 2");
+ rtcout2.println(Logbuf.WARN, "WARN string 2");
+ rtcout2.println(Logbuf.ERROR, "ERROR string 2");
+ rtcout2.println(Logbuf.FATAL, "FATAL string 2");
+ rtcout2.println(Logbuf.SILENT, "SILENT string 2");
// setLevel(INFO)以下の内容が、出力されればOK.
rtcout2.setLevel("PARANOID");
System.err.println("--- Logbuf(Manager.hoge1) set ---");
- rtcout2.println(rtcout2.INFO, "--- setLevel(PARANOID) set ---");
- rtcout2.println(rtcout2.PARANOID, "PARANOID string 3");
- rtcout2.println(rtcout2.VERBOSE, "VERBOSE string 3");
- rtcout2.println(rtcout2.TRACE, "TRACE string 3");
- rtcout2.println(rtcout2.DEBUG, "DEBUG string 3");
- rtcout2.println(rtcout2.INFO, "INFO string 3");
- rtcout2.println(rtcout2.WARN, "WARN string 3");
- rtcout2.println(rtcout2.ERROR, "ERROR string 3");
- rtcout2.println(rtcout2.FATAL, "FATAL string 3");
- rtcout2.println(rtcout2.SILENT, "SILENT string 3");
+ rtcout2.println(Logbuf.INFO, "--- setLevel(PARANOID) set ---");
+ rtcout2.println(Logbuf.PARANOID, "PARANOID string 3");
+ rtcout2.println(Logbuf.VERBOSE, "VERBOSE string 3");
+ rtcout2.println(Logbuf.TRACE, "TRACE string 3");
+ rtcout2.println(Logbuf.DEBUG, "DEBUG string 3");
+ rtcout2.println(Logbuf.INFO, "INFO string 3");
+ rtcout2.println(Logbuf.WARN, "WARN string 3");
+ rtcout2.println(Logbuf.ERROR, "ERROR string 3");
+ rtcout2.println(Logbuf.FATAL, "FATAL string 3");
+ rtcout2.println(Logbuf.SILENT, "SILENT string 3");
// setLevel(PARANOID)以下の内容が、出力されればOK.
Logbuf rtcout3 = new Logbuf("hoge2");
rtcout3.setEnabled();
System.err.println("--- Logbuf(hoge2) set ---");
- rtcout3.println(rtcout3.INFO, "--- setLevel(INFO) Not set ---");
- rtcout3.println(rtcout3.PARANOID, "PARANOID string 4");
- rtcout3.println(rtcout3.VERBOSE, "VERBOSE string 4");
- rtcout3.println(rtcout3.TRACE, "TRACE string 4");
- rtcout3.println(rtcout3.DEBUG, "DEBUG string 4");
- rtcout3.println(rtcout3.INFO, "INFO string 4");
- rtcout3.println(rtcout3.WARN, "WARN string 4");
- rtcout3.println(rtcout3.ERROR, "ERROR string 4");
- rtcout3.println(rtcout3.FATAL, "FATAL string 4");
- rtcout3.println(rtcout3.SILENT, "SILENT string 4");
+ rtcout3.println(Logbuf.INFO, "--- setLevel(INFO) Not set ---");
+ rtcout3.println(Logbuf.PARANOID, "PARANOID string 4");
+ rtcout3.println(Logbuf.VERBOSE, "VERBOSE string 4");
+ rtcout3.println(Logbuf.TRACE, "TRACE string 4");
+ rtcout3.println(Logbuf.DEBUG, "DEBUG string 4");
+ rtcout3.println(Logbuf.INFO, "INFO string 4");
+ rtcout3.println(Logbuf.WARN, "WARN string 4");
+ rtcout3.println(Logbuf.ERROR, "ERROR string 4");
+ rtcout3.println(Logbuf.FATAL, "FATAL string 4");
+ rtcout3.println(Logbuf.SILENT, "SILENT string 4");
// setLevel(INFO)以下の内容が、出力されればOK.
rtcout3.setLevel("PARANOID");
System.err.println("--- Logbuf(hoge2) set ---");
- rtcout3.println(rtcout3.INFO, "--- setLevel(PARANOID) set ---");
- rtcout3.println(rtcout3.PARANOID, "PARANOID string 5");
- rtcout3.println(rtcout3.VERBOSE, "VERBOSE string 5");
- rtcout3.println(rtcout3.TRACE, "TRACE string 5");
- rtcout3.println(rtcout3.DEBUG, "DEBUG string 5");
- rtcout3.println(rtcout3.INFO, "INFO string 5");
- rtcout3.println(rtcout3.WARN, "WARN string 5");
- rtcout3.println(rtcout3.ERROR, "ERROR string 5");
- rtcout3.println(rtcout3.FATAL, "FATAL string 5");
- rtcout3.println(rtcout3.SILENT, "SILENT string 5");
+ rtcout3.println(Logbuf.INFO, "--- setLevel(PARANOID) set ---");
+ rtcout3.println(Logbuf.PARANOID, "PARANOID string 5");
+ rtcout3.println(Logbuf.VERBOSE, "VERBOSE string 5");
+ rtcout3.println(Logbuf.TRACE, "TRACE string 5");
+ rtcout3.println(Logbuf.DEBUG, "DEBUG string 5");
+ rtcout3.println(Logbuf.INFO, "INFO string 5");
+ rtcout3.println(Logbuf.WARN, "WARN string 5");
+ rtcout3.println(Logbuf.ERROR, "ERROR string 5");
+ rtcout3.println(Logbuf.FATAL, "FATAL string 5");
+ rtcout3.println(Logbuf.SILENT, "SILENT string 5");
// setLevel(PARANOID)以下の内容が、出力されればOK.
@@ -1084,30 +1239,30 @@
Logbuf rtcout4 = new Logbuf("hoge3", "Manager");
rtcout4.setEnabled();
System.err.println("--- Logbuf(Manager.hoge3) set ---");
- rtcout4.println(rtcout4.INFO, "--- setLevel(INFO) Not set ---");
- rtcout4.println(rtcout4.PARANOID, "PARANOID string 6");
- rtcout4.println(rtcout4.VERBOSE, "VERBOSE string 6");
- rtcout4.println(rtcout4.TRACE, "TRACE string 6");
- rtcout4.println(rtcout4.DEBUG, "DEBUG string 6");
- rtcout4.println(rtcout4.INFO, "INFO string 6");
- rtcout4.println(rtcout4.WARN, "WARN string 6");
- rtcout4.println(rtcout4.ERROR, "ERROR string 6");
- rtcout4.println(rtcout4.FATAL, "FATAL string 6");
- rtcout4.println(rtcout4.SILENT, "SILENT string 6");
+ rtcout4.println(Logbuf.INFO, "--- setLevel(INFO) Not set ---");
+ rtcout4.println(Logbuf.PARANOID, "PARANOID string 6");
+ rtcout4.println(Logbuf.VERBOSE, "VERBOSE string 6");
+ rtcout4.println(Logbuf.TRACE, "TRACE string 6");
+ rtcout4.println(Logbuf.DEBUG, "DEBUG string 6");
+ rtcout4.println(Logbuf.INFO, "INFO string 6");
+ rtcout4.println(Logbuf.WARN, "WARN string 6");
+ rtcout4.println(Logbuf.ERROR, "ERROR string 6");
+ rtcout4.println(Logbuf.FATAL, "FATAL string 6");
+ rtcout4.println(Logbuf.SILENT, "SILENT string 6");
// setLevel(INFO)以下の内容が、出力されればOK.
rtcout4.setLevel("PARANOID");
System.err.println("--- Logbuf(Manager.hoge3) set ---");
- rtcout4.println(rtcout4.INFO, "--- setLevel(PARANOID) set ---");
- rtcout4.println(rtcout4.PARANOID, "PARANOID string 7");
- rtcout4.println(rtcout4.VERBOSE, "VERBOSE string 7");
- rtcout4.println(rtcout4.TRACE, "TRACE string 7");
- rtcout4.println(rtcout4.DEBUG, "DEBUG string 7");
- rtcout4.println(rtcout4.INFO, "INFO string 7");
- rtcout4.println(rtcout4.WARN, "WARN string 7");
- rtcout4.println(rtcout4.ERROR, "ERROR string 7");
- rtcout4.println(rtcout4.FATAL, "FATAL string 7");
- rtcout4.println(rtcout4.SILENT, "SILENT string 7");
+ rtcout4.println(Logbuf.INFO, "--- setLevel(PARANOID) set ---");
+ rtcout4.println(Logbuf.PARANOID, "PARANOID string 7");
+ rtcout4.println(Logbuf.VERBOSE, "VERBOSE string 7");
+ rtcout4.println(Logbuf.TRACE, "TRACE string 7");
+ rtcout4.println(Logbuf.DEBUG, "DEBUG string 7");
+ rtcout4.println(Logbuf.INFO, "INFO string 7");
+ rtcout4.println(Logbuf.WARN, "WARN string 7");
+ rtcout4.println(Logbuf.ERROR, "ERROR string 7");
+ rtcout4.println(Logbuf.FATAL, "FATAL string 7");
+ rtcout4.println(Logbuf.SILENT, "SILENT string 7");
// setLevel(PARANOID)以下の内容が、出力されればOK.
rtcout.removeStream(stdout);
@@ -1141,30 +1296,30 @@
Logbuf rtcout = new Logbuf("FileOuttest");
System.err.println("--- Logbuf(FileOuttest) set ---");
- rtcout.println(rtcout.INFO, "--- setLevel(INFO) Not set ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string 10");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string 10");
- rtcout.println(rtcout.TRACE, "TRACE string 10");
- rtcout.println(rtcout.DEBUG, "DEBUG string 10");
- rtcout.println(rtcout.INFO, "INFO string 10");
- rtcout.println(rtcout.WARN, "WARN string 10");
- rtcout.println(rtcout.ERROR, "ERROR string 10");
- rtcout.println(rtcout.FATAL, "FATAL string 10");
- rtcout.println(rtcout.SILENT, "SILENT string 10");
+ rtcout.println(Logbuf.INFO, "--- setLevel(INFO) Not set ---");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string 10");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string 10");
+ rtcout.println(Logbuf.TRACE, "TRACE string 10");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string 10");
+ rtcout.println(Logbuf.INFO, "INFO string 10");
+ rtcout.println(Logbuf.WARN, "WARN string 10");
+ rtcout.println(Logbuf.ERROR, "ERROR string 10");
+ rtcout.println(Logbuf.FATAL, "FATAL string 10");
+ rtcout.println(Logbuf.SILENT, "SILENT string 10");
// setLevel(INFO)以下の内容が、出力されればOK.
rtcout.setLevel("PARANOID");
System.err.println("--- Logbuf(Manager.FileOuttest) set ---");
- rtcout.println(rtcout.INFO, "--- setLevel(PARANOID) set ---");
- rtcout.println(rtcout.PARANOID, "PARANOID string 11");
- rtcout.println(rtcout.VERBOSE, "VERBOSE string 11");
- rtcout.println(rtcout.TRACE, "TRACE string 11");
- rtcout.println(rtcout.DEBUG, "DEBUG string 11");
- rtcout.println(rtcout.INFO, "INFO string 11");
- rtcout.println(rtcout.WARN, "WARN string 11");
- rtcout.println(rtcout.ERROR, "ERROR string 11");
- rtcout.println(rtcout.FATAL, "FATAL string 11");
- rtcout.println(rtcout.SILENT, "SILENT string 11");
+ rtcout.println(Logbuf.INFO, "--- setLevel(PARANOID) set ---");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string 11");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string 11");
+ rtcout.println(Logbuf.TRACE, "TRACE string 11");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string 11");
+ rtcout.println(Logbuf.INFO, "INFO string 11");
+ rtcout.println(Logbuf.WARN, "WARN string 11");
+ rtcout.println(Logbuf.ERROR, "ERROR string 11");
+ rtcout.println(Logbuf.FATAL, "FATAL string 11");
+ rtcout.println(Logbuf.SILENT, "SILENT string 11");
// setLevel()以下の内容が、出力されればOK.
@@ -1187,61 +1342,85 @@
rtcout2.setLevel("INFO");
System.err.println("--- Logbuf(PortBase) set ---");
- rtcout2.println(rtcout2.INFO, "--- setLevel(INFO) Not set ---");
- rtcout2.println(rtcout2.PARANOID, "PARANOID string 20");
- rtcout2.println(rtcout2.VERBOSE, "VERBOSE string 20");
- rtcout2.println(rtcout2.TRACE, "TRACE string 20");
- rtcout2.println(rtcout2.DEBUG, "DEBUG string 20");
- rtcout2.println(rtcout2.INFO, "INFO string 20");
- rtcout2.println(rtcout2.WARN, "WARN string 20");
- rtcout2.println(rtcout2.ERROR, "ERROR string 20");
- rtcout2.println(rtcout2.FATAL, "FATAL string 20");
- rtcout2.println(rtcout2.SILENT, "SILENT string 20");
+ rtcout2.println(Logbuf.INFO, "--- setLevel(INFO) Not set ---");
+ rtcout2.println(Logbuf.PARANOID, "PARANOID string 20");
+ rtcout2.println(Logbuf.VERBOSE, "VERBOSE string 20");
+ rtcout2.println(Logbuf.TRACE, "TRACE string 20");
+ rtcout2.println(Logbuf.DEBUG, "DEBUG string 20");
+ rtcout2.println(Logbuf.INFO, "INFO string 20");
+ rtcout2.println(Logbuf.WARN, "WARN string 20");
+ rtcout2.println(Logbuf.ERROR, "ERROR string 20");
+ rtcout2.println(Logbuf.FATAL, "FATAL string 20");
+ rtcout2.println(Logbuf.SILENT, "SILENT string 20");
// setLevel()以下の内容が、出力されればOK.
rtcout2.setLevel("PARANOID");
System.err.println("--- Logbuf(PortBase) set ---");
- rtcout2.println(rtcout2.INFO, "--- setLevel(PARANOID) set ---");
- rtcout2.println(rtcout2.PARANOID, "PARANOID string 21");
- rtcout2.println(rtcout2.VERBOSE, "VERBOSE string 21");
- rtcout2.println(rtcout2.TRACE, "TRACE string 21");
- rtcout2.println(rtcout2.DEBUG, "DEBUG string 21");
- rtcout2.println(rtcout2.INFO, "INFO string 21");
- rtcout2.println(rtcout2.WARN, "WARN string 21");
- rtcout2.println(rtcout2.ERROR, "ERROR string 21");
- rtcout2.println(rtcout2.FATAL, "FATAL string 21");
- rtcout2.println(rtcout2.SILENT, "SILENT string 21");
+ rtcout2.println(Logbuf.INFO, "--- setLevel(PARANOID) set ---");
+ rtcout2.println(Logbuf.PARANOID, "PARANOID string 21");
+ rtcout2.println(Logbuf.VERBOSE, "VERBOSE string 21");
+ rtcout2.println(Logbuf.TRACE, "TRACE string 21");
+ rtcout2.println(Logbuf.DEBUG, "DEBUG string 21");
+ rtcout2.println(Logbuf.INFO, "INFO string 21");
+ rtcout2.println(Logbuf.WARN, "WARN string 21");
+ rtcout2.println(Logbuf.ERROR, "ERROR string 21");
+ rtcout2.println(Logbuf.FATAL, "FATAL string 21");
+ rtcout2.println(Logbuf.SILENT, "SILENT string 21");
// setLevel()以下の内容が、出力されればOK.
Logbuf rtcout3 = new Logbuf("PublisherFlush", "PortBase");
System.err.println("--- Logbuf(PortBase.PublisherFlush) set ---");
- rtcout3.println(rtcout3.PARANOID, "PARANOID string 22");
- rtcout3.println(rtcout3.VERBOSE, "VERBOSE string 22");
- rtcout3.println(rtcout3.TRACE, "TRACE string 22");
- rtcout3.println(rtcout3.DEBUG, "DEBUG string 22");
- rtcout3.println(rtcout3.INFO, "INFO string 22");
- rtcout3.println(rtcout3.WARN, "WARN string 22");
- rtcout3.println(rtcout3.ERROR, "ERROR string 22");
- rtcout3.println(rtcout3.FATAL, "FATAL string 22");
- rtcout3.println(rtcout3.SILENT, "SILENT string 22");
+ rtcout3.println(Logbuf.PARANOID, "PARANOID string 22");
+ rtcout3.println(Logbuf.VERBOSE, "VERBOSE string 22");
+ rtcout3.println(Logbuf.TRACE, "TRACE string 22");
+ rtcout3.println(Logbuf.DEBUG, "DEBUG string 22");
+ rtcout3.println(Logbuf.INFO, "INFO string 22");
+ rtcout3.println(Logbuf.WARN, "WARN string 22");
+ rtcout3.println(Logbuf.ERROR, "ERROR string 22");
+ rtcout3.println(Logbuf.FATAL, "FATAL string 22");
+ rtcout3.println(Logbuf.SILENT, "SILENT string 22");
// setLevel()以下の内容が、出力されればOK.
rtcout3.setLevel("PARANOID");
System.err.println("--- Logbuf(PortBase.PublisherFlush) set ---");
- rtcout3.println(rtcout3.INFO, "--- setLevel(PARANOID) set ---");
- rtcout3.println(rtcout3.PARANOID, "PARANOID string 23");
- rtcout3.println(rtcout3.VERBOSE, "VERBOSE string 23");
- rtcout3.println(rtcout3.TRACE, "TRACE string 23");
- rtcout3.println(rtcout3.DEBUG, "DEBUG string 23");
- rtcout3.println(rtcout3.INFO, "INFO string 23");
- rtcout3.println(rtcout3.WARN, "WARN string 23");
- rtcout3.println(rtcout3.ERROR, "ERROR string 23");
- rtcout3.println(rtcout3.FATAL, "FATAL string 23");
- rtcout3.println(rtcout3.SILENT, "SILENT string 23");
+ rtcout3.println(Logbuf.INFO, "--- setLevel(PARANOID) set ---");
+ rtcout3.println(Logbuf.PARANOID, "PARANOID string 23");
+ rtcout3.println(Logbuf.VERBOSE, "VERBOSE string 23");
+ rtcout3.println(Logbuf.TRACE, "TRACE string 23");
+ rtcout3.println(Logbuf.DEBUG, "DEBUG string 23");
+ rtcout3.println(Logbuf.INFO, "INFO string 23");
+ rtcout3.println(Logbuf.WARN, "WARN string 23");
+ rtcout3.println(Logbuf.ERROR, "ERROR string 23");
+ rtcout3.println(Logbuf.FATAL, "FATAL string 23");
+ rtcout3.println(Logbuf.SILENT, "SILENT string 23");
// setLevel()以下の内容が、出力されればOK.
System.err.println("--- test_manager_logbuf2() end ---");
}
+ private class LocalHandler extends Handler {
+ StringBuilder builder = new StringBuilder();
+
+ @Override
+ public void close() throws SecurityException {
+ }
+
+ @Override
+ public void flush() {
+ }
+
+ @Override
+ public void publish(LogRecord record) {
+ builder.append(record.getMessage()).append(System.getProperty("line.separator"));
+ }
+
+ public String getStr() {
+ return builder.toString();
+ }
+
+ public void clear() {
+ builder = new StringBuilder();
+ }
+ }
}
Added: trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java (rev 0)
+++ trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -0,0 +1,44 @@
+package jp.go.aist.rtm.RTC.util;
+
+import jp.go.aist.rtm.RTC.util.clock.AdjustedClock;
+import junit.framework.TestCase;
+
+/**
+* AdjustedClockクラス テスト
+* 対象クラス:AdjustedClock
+*
+*/
+public class AdjustedClockTest extends TestCase {
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * 時間オフセットのテスト
+ * setTime()で設定されたオフセットが有効となっているか確認する
+ */
+ public void test_offset() {
+ AdjustedClock clock = new AdjustedClock();
+ long msec = System.currentTimeMillis();
+ long sec = msec/1000;
+ long usec = (msec - sec*1000)*1000;
+ TimeValue time = new TimeValue(sec-30, usec);
+ clock.setTime(time);
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ //
+ long msec2 = System.currentTimeMillis();
+ long sec2 = msec2/1000;
+ long usec2 = (msec2 - sec2*1000)*1000;
+ assertEquals(sec2-30, clock.getTime().getSec());
+ assertEquals(usec2, clock.getTime().getUsec());
+ }
+
+}
Modified: trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/TimeValueTest.java
===================================================================
--- trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/TimeValueTest.java 2013-02-03 04:17:17 UTC (rev 684)
+++ trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/TimeValueTest.java 2013-02-06 04:57:23 UTC (rev 685)
@@ -1,5 +1,8 @@
package jp.go.aist.rtm.RTC.util;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import jp.go.aist.rtm.RTC.util.TimeValue;
import junit.framework.TestCase;
@@ -276,4 +279,25 @@
res = tm1.toDouble();
assertEquals(Double.valueOf(1.000001), Double.valueOf(res));
}
+ /**
+ * <p>現在時刻の変換 チェック
+ * <ul>
+ * <li>現在時刻の変換が正常に行えるか?</li>
+ * </ul>
+ */
+ public void test_date() {
+ Date date = new Date();
+ long msec = System.currentTimeMillis();
+ long sec = msec/1000;
+ long usec = (msec - sec*1000)*1000;
+ TimeValue base = new TimeValue(sec, usec);
+ double curr = base.toDouble();
+ assertEquals(sec, (long)curr);
+
+ Date convdate = new Date((long)(curr*1000));
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSSSS");
+ String strCurrent = sdf1.format(date);
+ String strConv = sdf1.format(convdate);
+ assertTrue(strCurrent.equals(strConv));
+ }
}
More information about the openrtm-commit
mailing list