the org.apache.log4j.PatternLayout java doc
A flexible layout configurable with pattern string.
The goal of this class is to format
a LoggingEvent
and return the results as a String. The results depend on the conversion
pattern
.
The conversion pattern is closely related to the conversion pattern of the
printf function in C. A conversion pattern is composed of literal text and
format control expressions called conversion specifiers
.
You are free to insert any literal text within the conversion pattern.
Each conversion specifier starts with a percent sign (%) and is followed by
optional format modifiers
and a conversion character
. The
conversion character specifies the type of data, e.g. category, priority, date,
thread name. The format modifiers control such things as field width, padding,
left and right justification. The following is a simple example.
Let the conversion pattern be "%-5p [%t]: %m%n"
and assume that the
log4j environment was set to use a PatternLayout. Then the statements
Category root = Category.getRoot();
root.debug("Message 1");
root.warn("Message 2");
would yield the output
DEBUG [main]: Message 1
WARN [main]: Message 2
Note that there is no explicit separator between text and conversion
specifiers. The pattern parser knows when it has reached the end of a conversion
specifier when it reads a conversion character. In the example above the
conversion specifier %-5p
means the priority of the logging event should
be left justified to a width of five characters. The recognized conversion
characters are
Conversion Character
Effect
c
Used to output the category of the logging event. The category conversion
specifier can be optionally followed by precision specifier
, that is a
decimal constant in brackets.
If a precision specifier is given, then only the corresponding number of
right most components of the category name will be printed. By default the
catego
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
类的初始化和对象初始化是 JVM 管理的类型生命周期中非常重要的两个环节,Google 了一遍网络,有关类装载机制的文章倒是不少,然而类初始化和对象初始化的文章并不多,特别是从字节码和 JVM 层次来分析的文章更是鲜有所见。
本文主要对类和对象初始化全过程进行分析,通过一个实际问题引入,将源代码转换成 JVM 字节码后, ......
1 JAVA的反射,其实就是通过一个实例化的对象反过来去找到一个类的完整信息,比如对于如下的形式:
X x=new X();
x.getClass().getName();
这里就会输出这个类所在的完整信息,即"包名.类名";
最常用的三种实例化CLASS类对象
Class<?> c1 = null ; // 指定泛型
C ......
定义:定义了算法族,分别封装起来,让它们之间可以互相替换,此模式让算法的变化独立于使用算法的客户。
适用性
许多相关的类仅仅是行为有异。“策略”提供了一种用多个行为中的一个行为来配置一个类的算法。
需要使用一个算法的不同变体。例如,你可能会定义一些反映不容的空间/时间权衡的算法。当这些变体实 ......