【问题标题】:Enabling NCSA access log with wsadmin scrpting使用 wsadmin 脚本启用 NCSA 访问日志
【发布时间】:2020-12-29 10:16:54
【问题描述】:

如何使用 wsadmin 脚本启用 NCSA 访问日志。

要在 WAS 控制台中查看 HTTP 通道的设置页面,我们按照以下步骤操作: 服务器 > 服务器类型 > WebSphere 应用程序服务器 > 服务器 > Web 容器设置 > Web 容器传输链 > 链 > HTTP 入站通道。

在控制台上,此任务没有管理帮助!! 谢谢

【问题讨论】:

    标签: console websphere jython wsadmin


    【解决方案1】:

    在sn-p下面使用。我为每个步骤添加了 cmets。

    在运行之前根据您的环境更新前两行 - serverName 和 chainName。

    serverName = 'server1'
    chainName = 'Chain'
    
    #update this variable to true/false to toggle logging on/off
    loggingEnabled = 'true'
    
    #Get the server id
    serverId = AdminConfig.getid('/Server:%s' %(serverName))
    
    #Get the list of all Web Container transport chains
    wcTransportChains = AdminTask.listChains(AdminConfig.list("TransportChannelService", serverId), '[-acceptorFilter WebContainerInboundChannel]').splitlines()
    
    #Iterate the list and find the chain we are interested in 
    for chain in wcTransportChains:
        if chain.startswith(chainName):
            #list all transport channles for this chain
            transportChannels = AdminConfig.showAttribute(chain, 'transportChannels').split(" ")
            #iterate the list and find HTTPInboundChannel to enable NCSA logging
            for channel in transportChannels:
                if channel.find('HTTPInboundChannel') != -1:
                    #Enable logging config
                    print ('\nEnabling NCSA logging for Transport Channel : %s on server : %s\n' %(AdminConfig.showAttribute(channel, 'name'), serverName))
                    AdminConfig.modify(channel, [['enableLogging', loggingEnabled]])
                #end if
            #end for
        #end if
    #end for
    
    #save the changes
    AdminConfig.save()
    

    【讨论】:

    • 谢谢。会试一试,让你知道
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    • 2013-09-18
    • 2022-06-16
    • 2014-06-13
    • 1970-01-01
    • 2021-11-18
    相关资源
    最近更新 更多