• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LoggingMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cxf.interceptor.LoggingMessage的典型用法代码示例。如果您正苦于以下问题:Java LoggingMessage类的具体用法?Java LoggingMessage怎么用?Java LoggingMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LoggingMessage类属于org.apache.cxf.interceptor包,在下文中一共展示了LoggingMessage类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
    String messageId = (String) message.getExchange().get(
            LoggingMessage.ID_KEY);
    LogBean bean = new LogBean();
    bean.setResponseTime(new Date());

    OutputStream stream = message.getContent(OutputStream.class);
    final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(
            stream);
    message.setContent(OutputStream.class, newOut);
    newOut.registerCallback(new LoggingCallback(messageId, bean));

}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:16,代码来源:UCOutLogInterceptor.java


示例2: doInterfaceLog

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
private void doInterfaceLog(Message message)
{
    String messageId = (String)message.getExchange().get(LoggingMessage.ID_KEY);
    String currentEnvelopeMessage = "";
    /*****/
    OutputStream os = message.getContent(OutputStream.class);        
    CachedStream cs = new CachedStream();
    message.setContent(OutputStream.class, cs);
    
    message.getInterceptorChain().doIntercept(message);
    
    try
    {
        cs.flush();
        IOUtils.closeQuietly(cs);
        CachedOutputStream csnew = (CachedOutputStream)message.getContent(OutputStream.class);
        
        currentEnvelopeMessage = IOUtils.toString(csnew.getInputStream(), "UTF-8");
        csnew.flush();
        IOUtils.closeQuietly(csnew);
        
        InputStream replaceInStream = IOUtils.toInputStream(currentEnvelopeMessage, "UTF-8");
        
        IOUtils.copy(replaceInStream, os);
        replaceInStream.close();
        IOUtils.closeQuietly(replaceInStream);
        
        os.flush();
        message.setContent(OutputStream.class, os);
        IOUtils.closeQuietly(os);
    }
    catch (IOException ioe)
    {
        throw new RuntimeException(ioe);
    }
    /*****/
    
    InterfaceLogBean bean = new InterfaceLogBean();
    bean.setTransactionId(messageId);
    bean.setReq(false);
    bean.setRespTime(new Date());
    bean.setResultCode(getResultCode(currentEnvelopeMessage));
    
    IInterfaceLog logger = ApplicationContextUtil.getBean("interfaceLogger");
    logger.info(bean);
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:47,代码来源:PlatformOutInterceptor.java


示例3: handleMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
    String messageId = (String) message.getExchange().get(
            LoggingMessage.ID_KEY);
    LogBean bean = new LogBean();
    bean.setResponseTime(new Date());

    OutputStream stream = message.getContent(OutputStream.class);
    final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(
            stream);
    message.setContent(OutputStream.class, newOut);
    newOut.registerCallback(new LoggingCallback(messageId,bean));

}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:16,代码来源:IVSOutLogInterceptor.java


示例4: logOperation

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
private void logOperation(SoapMessage soapMessage, HttpServletRequest req, String soapAction)
{
    String interfaceName = soapAction.substring(
        soapAction.lastIndexOf(".") + 1, soapAction.length() - 1);;
    if (!soapAction.equals("keepAlive"))
    {
        String messageId = (String) soapMessage.getExchange().get(
                LoggingMessage.ID_KEY);
        if (messageId == null)
        {
            messageId = LoggingMessage.nextId();
            soapMessage.getExchange().put(LoggingMessage.ID_KEY, messageId);
        }

        InterfaceLogBean bean = new InterfaceLogBean();
        bean.setTransactionId(messageId);
        bean.setProduct("IVS");
        bean.setInterfaceType("1");
        bean.setProtocolType("SOAP");
        bean.setReq(true);
        bean.setName(interfaceName);
        bean.setSourceAddr(req.getRemoteHost());
        bean.setTargetAddr(req.getLocalAddr());
        bean.setReqTime(new Date());
        
        IInterfaceLog logger = ApplicationContextUtil.getBean("interfaceLogger");
        logger.info(bean);
    }
}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:30,代码来源:LoginAuthorize.java


示例5: formatLogEntry

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
private String formatLogEntry(final Message msg, final long executionTime) {
    return StringJoiner.join(";", Arrays.asList(
            "" + DateUtils.format(new Date()),
            "" + executionTime,
            "" + msg.getExchange().get(Message.ENDPOINT_ADDRESS),
            "id_" + msg.getExchange().get(LoggingMessage.ID_KEY)
            )
    );
}
 
开发者ID:todvora,项目名称:eet-client,代码行数:10,代码来源:TimingReceiveInterceptor.java


示例6: formatLoggingMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
protected String formatLoggingMessage(LoggingMessage loggingMessage) {
    // Only write the Payload (SOAP-Xml) to Logger
    if (loggingMessage.getPayload().length() > 0) {
        LOG.info(append(SOAP_MESSAGE_OUTBOUND, loggingMessage.getPayload().toString()), "Log Outbound-SoapMessage to Elasticseach");
    }
    // This is just hook into CXF and get the SOAP-Message.
    // The returned String will never be logged somewhere.
    return "";
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:11,代码来源:SoapMsgToMdcExtractionLoggingOutInterceptor.java


示例7: formatLoggingMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
protected String formatLoggingMessage(LoggingMessage loggingMessage) {
    // Only write the Payload (SOAP-Xml) to Logger
    if (loggingMessage.getPayload().length() > 0) {
        LOG.info(append(SOAP_MESSAGE_INBOUND, loggingMessage.getPayload().toString()), "Log Inbound-SoapMessage to Elasticseach");
    }
    // This is just hook into CXF and get the SOAP-Message.
    // The returned String will never be logged somewhere.
    return "";
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:11,代码来源:SoapMsgToMdcExtractionLoggingInInterceptor.java


示例8: formatLoggingMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
protected String formatLoggingMessage(LoggingMessage loggingMessage) {
    StringBuilder buffer = new StringBuilder();
    buffer.append("Outbound Message:\n");

    // Only write the Payload (SOAP-Xml) to Logger
    if (loggingMessage.getPayload().length() > 0) {
        buffer.append(loggingMessage.getPayload());
    }
    return buffer.toString();
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:12,代码来源:LoggingOutInterceptorXmlOnly.java


示例9: formatLoggingMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
protected String formatLoggingMessage(LoggingMessage loggingMessage) {
    StringBuilder buffer = new StringBuilder();
    buffer.append("Inbound Message:\n");

    // Only write the Payload (SOAP-Xml) to Logger
    if (loggingMessage.getPayload().length() > 0) {
        buffer.append(loggingMessage.getPayload());
    }        
    return buffer.toString();
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:12,代码来源:LoggingInInterceptorXmlOnly.java


示例10: handleMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	try
	{
		final LoggingMessage buffer = new LoggingMessage("Outbound Message\n---------------------------");
		buffer.getHeader().append(Message.CONTENT_TYPE).append(":").append(message.get(Message.CONTENT_TYPE));
		String encoding = (String)message.get(Message.ENCODING);
		if (encoding != null)
			buffer.getEncoding().append(encoding);
		Object headers = message.get(Message.PROTOCOL_HEADERS);
		if (headers != null)
			buffer.getHeader().append(headers);

		CachedOutputStream cos = (CachedOutputStream)message.getContent(OutputStream.class);
		OutputStream originalOs = (OutputStream)message.get(OUTPUT_STREAM_HOLDER);
		cos.writeCacheTo(buffer.getPayload(),limit);
		cos.writeCacheTo(originalOs);
		message.setContent(OutputStream.class,originalOs);
		
		if (logger.isInfoEnabled())
			logger.info(buffer.toString());
	}
	catch (IOException e)
	{
		new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:29,代码来源:LoggingOutInterceptor.java


示例11: handleMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
@Override
public void handleMessage(Message message)
    throws Fault
{
    // 通知流量监控模块
    IMonitor monitor = ApplicationContextUtil.getBean("northFCMonitor");
    if (monitor != null)
    {
        monitor.reportStatus(1); // 增加一次SOAP调用
        IPerformer performer = ApplicationContextUtil.getBean("northFCPerformer");
        if (performer != null)
        {
            if (performer.doFilter(message))
            {
                monitor.reportStatus(-1); // 被流控消息不计入监控数据
                LOGGER.info("*****北向消息,线程id=*****" + Thread.currentThread().getId() + "被流控");
                SOAPException soapExc = new SOAPException("");
                Fault fault = new Fault(soapExc);
                fault.setFaultCode(new QName(Integer.toString(ESDKErrorCodeConstant.ERROR_CODE_SDK_SYSBUSY)));
                throw fault;
            }
        }
    }
    
    HttpServletRequest req = (HttpServletRequest)message.get("HTTP.REQUEST");
    String ip = req.getRemoteAddr();
    MessageContext mc = ThreadLocalHolder.get();
    if (null == mc)
    {
        mc = new MessageContext();
        ThreadLocalHolder.set(mc);
    }
    mc.getEntities().put(ESDKConstant.ESDK_CLIENT_IP, ip);
    
    String soapAction = req.getHeader("SOAPAction");
    if (null != soapAction)
    {
        String interfaceName = soapAction.substring(1, soapAction.length() - 1);
        // 记录调用日志
        String messageId = (String)message.getExchange().get(LoggingMessage.ID_KEY);
        if (messageId == null)
        {
            messageId = LoggingMessage.nextId();
            message.getExchange().put(LoggingMessage.ID_KEY, messageId);
        }
        
        LogBean bean = new LogBean();
        bean.setActionName(interfaceName);
        bean.setRequestTime(new Date());
        bean.setIp(req.getRemoteHost());
        bean.setPort(req.getRemotePort() + "");
        LogInterface log = ApplicationContextUtil.getBean("logManager");
        log.saveRequestLog(messageId, bean);
    }
    
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:57,代码来源:UCInterceptor.java


示例12: CxfExhangeMessage

import org.apache.cxf.interceptor.LoggingMessage; //导入依赖的package包/类
public CxfExhangeMessage(Type type, LoggingMessage loggingMessage) {
    this.type = type;
    this.loggingMessage = loggingMessage;
}
 
开发者ID:kantega,项目名称:respiro,代码行数:5,代码来源:CxfExhangeMessage.java



注:本文中的org.apache.cxf.interceptor.LoggingMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SentenceIndexAnnotation类代码示例发布时间:2022-05-23
下一篇:
Java RequestResponsePact类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap