英文:
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("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())
}
}
[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>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论