如何访问在Confluence的Scriptrunner中编写的代码的整个日志。

huangapple go评论121阅读模式
英文:

How to access the whole log for code written on scriptrunner for confluence

问题

我正在使用Confluence的Scriptrunner编写代码,以检索有关一个空间中页面的一些信息。我正在记录一些信息,但日志超过了300个字符。

作为Confluence管理员,如何访问显示所有信息的完整日志?

以下是我正在使用的代码:

import com.atlassian.confluence.links.OutgoingLink
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.spaces.Space
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.sal.api.component.ComponentLocator
import org.apache.log4j.Logger
import com.atlassian.confluence.user.UserAccessor
import com.atlassian.sal.api.user.UserKey

SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager)
PageManager pageManager = ComponentLocator.getComponent(PageManager)
UserAccessor userAccessor = ComponentLocator.getComponent(UserAccessor)

Space space = spaceManager.getSpace("IWIKI")

for (Page page : pageManager.getPages(space, true)) {
    if(page.getCreator()==null){
            log.warn(page.toString()+",null")
    }
    else{
            String userID=page.getCreator().getName()
            String fullName =userAccessor.getUserByKey(page.getCreator().getKey()).getFullName()
            log.warn(page.toString()+","+userID+","+fullName+","+page.getLastModificationDate())

    }

}

<details>
<summary>英文:</summary>

I am writing code on scriptrunner for confluence to retrieve some information about the pages in one space.  I am logging some information but the log exceeds 300[![enter image description here][1]][1] 

How can I access the full log showing all of the information being a confluence admin? 

Here is the code that I am using below: 

    import com.atlassian.confluence.links.OutgoingLink
    import com.atlassian.confluence.pages.Page
    import com.atlassian.confluence.pages.PageManager
    import com.atlassian.confluence.spaces.Space
    import com.atlassian.confluence.spaces.SpaceManager
    import com.atlassian.sal.api.component.ComponentLocator
    import org.apache.log4j.Logger
    import com.atlassian.confluence.user.UserAccessor
    import com.atlassian.sal.api.user.UserKey
    
    SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager)
    PageManager pageManager = ComponentLocator.getComponent(PageManager)
    UserAccessor userAccessor = ComponentLocator.getComponent(UserAccessor)
    
    Space space = spaceManager.getSpace(&quot;IWIKI&quot;)
    
    
    for (Page page : pageManager.getPages(space, true)) {
        if(page.getCreator()==null){
                log.warn(page.toString()+&quot;,null&quot;)
        }
        else{
                String userID=page.getCreator().getName()
                String fullName =userAccessor.getUserByKey(page.getCreator().getKey()).getFullName()
                log.warn(page.toString()+&quot;,&quot;+userID+&quot;,&quot;+fullName+&quot;,&quot;+page.getLastModificationDate())
    
        }
    
       
    }


  [1]: https://i.stack.imgur.com/VYHxZ.png

</details>


# 答案1
**得分**: 1

转到“脚本”中的“构建”选项,并选择“日志”。您将能够看到使用`log.warn(...)`打印的所有打印语句的完整日志。

<details>
<summary>英文:</summary>

Go to Build in Scripts and choose log. You will be able to see the whole log of print statements that were printed using 

    log.warn(...)

</details>



huangapple
  • 本文由 发表于 2023年7月3日 19:52:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76604474.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定