Tuesday, July 5, 2011

log4j level

Log4J Levels

Log4J Levels

Loggers may be assigned levels. The set of possible levels, that is DEBUG, INFO, WARN, ERROR and FATAL are defined in the org.apache.log4j.Level class.

If a given logger is not assigned a level, then it inherits one from its closest ancestor with an assigned level.

The root logger resides at the top of the logger hierarchy. It always exists and always has an assigned level.

The logger is the core component of the logging process. In log4j, there are 5 normal levels Levels of logger available (not including custom Levels), the following is borrowed from the log4j API (http://jakarta.apache.org/log4j/docs/api/index.html):
static Level DEBUG - The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
static Level INFO - The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
static Level WARN - The WARN level designates potentially harmful situations.
static Level ERROR - The ERROR level designates error events that might still allow the application to continue running.
static Level FATAL - The FATAL level designates very severe error events that will presumably lead the application to abort.

In addition, there are two special levels of logging available: (descriptions borrowed from the log4j API http://jakarta.apache.org/log4j/docs/api/index.html):

static Level ALL -The ALL Level has the lowest possible rank and is intended to turn on all logging.
static Level OFF - The OFF Level has the highest possible rank and is intended to turn off logging.

Thursday, June 23, 2011

Cable Network terms

DTV:digital TV
L2VPN:layer 2 vpn
L3VPN:layer 3 vpn
SIP: session Initiation Protocol
IMS: IP Multimedia subsystem
PCMM:Packet Cable Multimedia
WiMAX: Worldwide interoperability for Microwave Access
PON:Passive Optical nework
HFC:Hybrid Fiber-Coax
MSO:multi system operator
I-CMTS:integrated Cable Modem Termination Sys
M-CMTS: Modular Cable Modem termination system
NSI:network side interface
PHY:Physical layer
ERMI:Edge resource management interface
CM: Cable modem
DOCSIS: Data over Cable Service Interface Specification
edge-eqam:edge quadrature amplitude modulation
SPA:shared port adapter
PRE4:performance routing engine 4
DTCC: DOCSIS Timing communication and Control
SIP:SPA Interface Processor
DTI:DOCSIS Timing Interface
PEM:Power Entry Module
RF:radio frequenct
US:up stream
DS:down stream
GE:gigabit ethernet
LC:line card

beautify sqlplus output

when runing following code in sql plus,we get a very messay output because of column data type and it's width;
--var rc refcursor
--exec tmp_pkg.get_cmts_bychassis_cursor(14,:rc)
--print rc

here is the output:
CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
14

CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
cmts11.nmkt

CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
14

CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
cmts11.nmkt

CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
i-cmts

CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
ubr10012

CMTS_SEQ
----------
CMTS_NAME
--------------------------------------------------------------------------------
CHASSIS_SEQ
-----------
CHASSIS_NAME
--------------------------------------------------------------------------------
CMTS_TYPE_NAME
--------------------------------------------------------------------------------
MODEL
--------------------------------------------------------------------------------
we need make it tide and neat:
first format those columns that are too long
column CMTS_SEQ format 999
column CMTS_NAME format a12
...
then rerun the code and print cursor
we will get follwing output

SQL> print rc

CMTS_SEQ CMTS_NAME CHASSIS_SEQ CHASSIS_NAME CMTS_TYPE_NAME MODEL
-------- ------------ ----------- ------------ ------------ ------------
14 cmts11.nmkt 14 cmts11.nmkt i-cmts ubr10012

cheers!

limited resultset in oracle sql statement

select * form dtt_cmts where rownum <20;

call storeprocedure from sqlplus

var rc refcursor
exec tmp_pkg.get_cmts_by_chasses_corsor(14,:rc)
print rc
note:there are not semicolon(;) at end os statement
14 is input parameter,rc is output parameter as a cursor

rlwrap help sqlplus to use up arrow key

download rlwrap
./configure
make
make install(maybe need sudo)
then run sqlplus like this:
rlwrap sqlplus user/pw@tnsname

connect to Oracle Db by sqlplus in linux

1) find tnsnames.ora
2) add or changes a entry like this
ORCLDBDTT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip address )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = STGSPDB)
)
)
note: ORCLDBDTT is a name call tns name,STGSPDB is a service ID
3)save the file connect to db by this:
sqlplus user/password@ORCLDBDTT