Skip to content

Commit

Permalink
继续上次log翻译
Browse files Browse the repository at this point in the history
  • Loading branch information
llitfkitfk committed Mar 13, 2013
1 parent 8e543c0 commit 76da238
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,30 @@ public static List<Dic> getDics(){
in = url.openStream();
byte[] data=FileUtils.readAll(in);
String xml=new String(data,"utf-8");
log.info("将DTD文件替换为绝对路径");
log.info("将DTD文件替换为绝对路径(Replace DID file into absolute path)");
xml=xml.replace("dic.dtd", FileUtils.getAbsolutePath(dtdFile));
log.info("将数据字典文件读取到字节数组中,长度为:"+data.length);
log.info("将数据字典文件读取到字节数组中,长度为(Load data dictionary into byte array, the length is):"+data.length);
ByteArrayInputStream bin=new ByteArrayInputStream(xml.getBytes("utf-8"));
log.info("注册dic.xml文件");
log.info("验证dic.xml文件");
log.info("注册dic.xml文件(Register dic.xml file)");
log.info("验证dic.xml文件(Verify dic.xml file )");
//校验文件
verifyFile(bin);
// 解析数据字典
parseDic(xml,dics);
}catch(Exception e)
{
log.error("解析数据字典出错",e);
log.error("解析数据字典出错(Error in parsing the data dictionary)",e);
}
finally {
try {
in.close();
} catch (IOException e) {
log.error("解析数据字典出错",e);
log.error("解析数据字典出错(Error in parsing the data dictionary)",e);
}
}
}
}catch(Exception e){
log.error("解析数据字典出错",e);
log.error("解析数据字典出错(Error in parsing the data dictionary)",e);
}
return dics;
}
Expand Down Expand Up @@ -148,10 +148,10 @@ private static void prepareDtd(){
private static void verifyFile(InputStream in){
boolean pass=XMLUtils.validateXML(in);
if(!pass){
log.info("验证没有通过,请参考dic.dtd文件");
log.info("验证没有通过,请参考dic.dtd文件(Validation failed, please refer to dic.dtd file)");
return ;
}
log.info("验证通过");
log.info("验证通过(Validation succeed)");
}
private static void print(Dic dic,String pre){
System.out.println(pre+dic.getChinese()+":"+dic.getEnglish());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,51 +41,51 @@ public void registe() {
private void registeDic(Dic dic){
Page<Dic> page=serviceFacade.query(Dic.class);
if(page.getTotalRecords()==0){
log.info("第一次注册第一个数据字典: "+dic.getChinese());
log.info("第一次注册第一个数据字典(First time to register the first data dictionary): "+dic.getChinese());
serviceFacade.create(dic);
//保存根数据字典
rootDic=dic;
data.add(dic);
}else{
log.info("以前已经注册过数据字典");
log.info("查找出根数据字典");
log.info("以前已经注册过数据字典(Already registered the data dictionary)");
log.info("查找出根数据字典(Find out the root data dictionary)");
Dic root=null;
Dic existRoot=dicService.getRootDic();
if(existRoot!=null){
root=existRoot;
log.info("找到以前导入的根数据字典: "+root.getChinese());
log.info("找到以前导入的根数据字典(Find out previous imported root data dictionary): "+root.getChinese());
}else{
log.info("没有找到以前导入的根数据字典");
log.info("没有找到以前导入的根数据字典(Failed to find out previous imported root data dictionary)");
if(rootDic!=null){
log.info("使用本次导入的根数据字典");
log.info("使用本次导入的根数据字典(Use the import root data dictionary)");
root=rootDic;
}
}
if(root!=null){
log.info("将第一次以后的数据字典的根数据字典设置为第一次注册的根数据字典");
log.info("将第一次以后的数据字典的根数据字典设置为第一次注册的根数据字典(Set the later data dictionary to the first registered root data dictionary)");
for(Dic subDic : dic.getSubDics()){
if(hasRegisteDic(subDic)){
log.info("数据字典 "+subDic.getChinese()+" 在此前已经被注册过,此次忽略,检查其子数据字典");
log.info("数据字典(This data dictionary) "+subDic.getChinese()+" (already registered)在此前已经被注册过,此次忽略,检查其子数据字典");
registeSubDic(subDic);
continue;
}
subDic.setParentDic(root);
log.info("注册后续数据字典: "+subDic.getChinese());
log.info("注册后续数据字典(Register the follow-up data dictionary): "+subDic.getChinese());
serviceFacade.create(subDic);
data.add(subDic);
}
}else{
log.info("没有找到根数据字典,注册失败!");
log.info("没有找到根数据字典,注册失败!(Not find out root data dictionary, failed to register)");
}
}
}
private void registeSubDic(Dic dic){
for(Dic sub : dic.getSubDics()){
if(hasRegisteDic(sub)){
log.info("数据字典 "+sub.getChinese()+" 在此前已经被注册过,此次忽略,检查其子数据字典");
log.info("数据字典(Data dictionary) "+sub.getChinese()+" (already registered, checking other sub-data dictionary)在此前已经被注册过,此次忽略,检查其子数据字典");
registeSubDic(sub);
}else{
log.info("注册后续数据字典: "+sub.getChinese());
log.info("注册后续数据字典(Register follow-up data dictionary): "+sub.getChinese());
//重新从数据库中查询出数据字典,参数中的数据字典是从XML中解析出来的
sub.setParentDic(dicService.getDic(dic.getEnglish()));
serviceFacade.create(sub);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
try {
logger.setServerIP(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
log.error("保存日志出错",ex);
log.error("保存日志出错(Error in saving log)",ex);
}
logger.setAppName(SystemListener.getContextPath());
String resource=req.getRequestURI().replace(logger.getAppName(), "");
Expand All @@ -62,28 +62,28 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha

@Override
public void init(FilterConfig fc) throws ServletException {
log.info("初始化性能过滤器");
log.info("初始化性能过滤器(Initialize the filter performance)");
enabled = PropertyHolder.getBooleanProperty("monitor.performance");
if(enabled){
log.info("启用性能分析日志");
log.info("启用性能分析日志(Enable performance analyzing log)");
}else{
log.info("禁用性能分析日志");
log.info("禁用性能分析日志(Disable performance analyzing log)");
}
}

@Override
public void destroy() {
log.info("销毁性能过滤器");
log.info("销毁性能过滤器(Destroy the filter performance)");
}

private boolean filter(HttpServletRequest req) {
String path=req.getRequestURI();
if(path.contains("/log/")){
log.info("路径包含/log/,不执行性能分析 "+path);
log.info("路径包含/log/,不执行性能分析(/log/ in path, not execute performance analysis) "+path);
return false;
}
if(path.contains("/monitor/")){
log.info("路径包含/monitor/,不执行性能分析 "+path);
log.info("路径包含/monitor/,不执行性能分析(/log/ in path, not execute performance analysis) "+path);
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ public class MemoryMonitorThread extends Thread{
private int circle=10;
public MemoryMonitorThread(int circle){
this.setDaemon(true);
this.setName("内存监视线程");
log.info("内存监视间隔为 "+circle+" 分钟");
this.setName("内存监视线程(Memory monitor thread)");
log.info("内存监视间隔为(Memory monitor interval) "+circle+" 分钟(min)");
this.circle=circle;
}

@Override
public void run(){
log.info("内存监视线程启动");
log.info("内存监视线程启动(Launch memory monitor thread)");
while(running){
log();
try {
Thread.sleep(circle*60*1000);
} catch (InterruptedException ex) {
if(!running){
log.info("内存监视线程退出");
log.info("内存监视线程退出(Exit memory monitor thread)");
}else{
log.error("内存监视线程出错",ex);
log.error("内存监视线程出错(Error in memory monitor thread)",ex);
}
}
}
Expand All @@ -49,7 +49,7 @@ private void log(){
try {
logger.setServerIP(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
log.error("户记录日志出错",ex);
log.error("用户记录日志出错(Error in user record log)",ex);
}
logger.setAppName(SystemListener.getContextPath());
logger.setRecordTime(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha

@Override
public void init(FilterConfig fc) throws ServletException {
log.info("初始化自动登录过滤器");
log.info("初始化自动登录过滤器(Initialize the automatic login filter)");
enabled = !SpringSecurityService.isSecurity();
defaultUserName = PropertyHolder.getProperty("auto.login.username");
if(enabled){
log.info("启用自动登录过滤器");
log.info("启用自动登录过滤器(Enable automatic login filter)");
}else{
log.info("禁用自动登录过滤器");
log.info("禁用自动登录过滤器(Disable automatic login filter)");
}
}

@Override
public void destroy() {
log.info("销毁自动登录过滤器");
log.info("销毁自动登录过滤器(Destroy the automatic login filter)");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ public void execute(){
public synchronized void saveLog(){
int len=logs.size();
int success=0;
log.info("保存前队列中的日志数目为:"+len);
log.info("保存前队列中的日志数目为(Num. of log before saving in the queue):"+len);
try{
for(int i=0;i<len;i++){
Model model = logs.remove();
try{
serviceFacade.create(model);
success++;
}catch(Exception e){
log.error("保存日志失败:"+model.getMetaData(),e);
log.error("保存日志失败(Failed to save log):"+model.getMetaData(),e);
}
}
} catch (Exception e) {
log.error("保存日志抛出异常",e);
log.error("保存日志抛出异常(Saving log exception)",e);
}
log.info("成功保存 "+success+" 条日志");
log.info("保存后队列中的日志数目为:"+logs.size());
log.info("成功保存(Success to save) "+success+" 条日志(log)");
log.info("保存后队列中的日志数目为(Num. of log after saving in the queue):"+logs.size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ protected static void saveFile(File file, String content) {

writer.write(content);
writer.flush();
log.info("生成的文件为:"+file.getAbsolutePath());
log.info("生成的文件为(Generated file is):"+file.getAbsolutePath());
} catch (IOException e) {
log.error("生成数据字典出错",e);
log.error("生成数据字典出错(Error in generate data dictionary)",e);
} finally {
if (writer != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@ public class ModelListener {
delete=PropertyHolder.getBooleanProperty("log.delete");
update=PropertyHolder.getBooleanProperty("log.update");
if(create){
log.info("启用添加数据日志");
log.info("启用添加数据日志(Enable add data log)");
}else{
log.info("禁用添加数据日志");
log.info("禁用添加数据日志(Disable add data log)");
}
if(delete){
log.info("启用删除数据日志");
log.info("启用删除数据日志(Enable delete data log)");
}else{
log.info("禁用删除数据日志");
log.info("禁用删除数据日志(Disable delete data log)");
}
if(update){
log.info("启用更新数据日志");
log.info("启用更新数据日志(Enable update data log)");
}else{
log.info("禁用更新数据日志");
log.info("禁用更新数据日志(Disable update data log)");
}
}

private boolean indexManagerUsable(){
if(indexManager==null){
indexManager=SpringContextUtils.getBean("indexManager");
if(indexManager==null){
log.info("实时索引不可用");
log.info("实时索引不可用(Real-time index is not available)");
}else{
log.info("实时索引开启");
log.info("实时索引开启(Launch real-time index)");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public static void addMetaData(Model model){
if(des.get(modelName)!=null){
return ;
}
log.info("注册模型元数据,"+modelName+"="+model.getMetaData());
log.info("注册模型元数据(Register model metadata),"+modelName+"="+model.getMetaData());
des.put(modelName, model.getMetaData());
metaData.put(modelName, model.getClass());
}
public static String getMetaData(String modelName){
modelName=modelName.toLowerCase();
String value = des.get(modelName);
if(value==null){
log.info("没有找到 "+modelName+" 的模型元数据");
log.info("没有找到(Not find model metadata) "+modelName+" 的模型元数据");
return "";
}
return value;
Expand Down
Loading

0 comments on commit 76da238

Please sign in to comment.