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] lines
[1]: https://i.stack.imgur.com/Smk4H.png
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())
}
}
Hi, @Mouna Hammoudi
I'll duplicate here my answer from your another post
/*
* Created 2023.
* @author Evgeniy Isaenkov
* @github https://github.com/Udjin79/SRUtils
*/
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 com.atlassian.confluence.user.UserAccessor
import org.apache.logging.log4j.Logger
import org.apache.logging.log4j.LogManager
Logger logger = LogManager.getLogger("my.logger")
SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager)
PageManager pageManager = ComponentLocator.getComponent(PageManager)
UserAccessor userAccessor = ComponentLocator.getComponent(UserAccessor)
Space space = spaceManager.getSpace("IWIKI")
String outLog = ""
for (Page page : pageManager.getPages(space, true)) {
if (page.getCreator() == null) {
outLog += "${page.toString()} is null\n"
} else {
String userID = page.getCreator().getName()
String fullName = userAccessor.getUserByKey(page.getCreator().getKey()).getFullName()
outLog =+ "${page.toString()}, ${userID}, ${fullName}, ${page.getLastModificationDate()}\n"
}
}
logger.warn(outLog)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.