Xcode内部调试日志

时间:2015-09-07 12:50:11

标签: xcode logging nsuserdefaults

我正在逆向工程Xcode,我想知道是否有办法启用调试日志。我猜Xcode可能有一些隐藏的偏好,是吗?

1 个答案:

答案 0 :(得分:24)

是的,您可以在Xcode中启用大量隐藏日志。以下是所有方面的列表,您可以在其中调整日志级别。使用

获取此列表
(lldb) po [[[DVTLogAspect allAspects] valueForKey:@"name"] sortedArrayUsingSelector:@selector(compare:)]
AutomaticTermination
AuxiliaryFilesWriting
BlockQueue
Build
BuildConfigurations
BuildContext
BuildInfo
BuildMessages
BuildPlanCreation
BuildRuleLoading
BuildSettingExpansion
BuildSettings
BuildTaskCreation
Building
Cache
CachePruning
Caching
Capabilities
ClangCodeCompletion
CodeSign
CodeSignUI
CommandInvocation
CommandLineBuildTiming
ConfigInspectionContext
Container
DBGDebugSessionPerformance
DBGFormattedSummaryPerformance
DBGNonPrimaryPCPerformance
DBGStackFrameFetchPerformance
DBGSteppingPerformance
DBGVariablesViewPerformance
DBGViewDebugger
DBGXPCDebugging
DSMDocSetLoading
DSMDocSetSearch
DVTActivityOptions
DVTAnnotationManager
DVTArchitecture
DVTAssertionEnvironment
DVTAssertions
DVTBindingHelper
DVTCodesigningAllTheThings
DVTCollectionChecking
DVTCommandLineTool
DVTDevice
DVTDeviceSearch
DVTDownloadable
DVTFilePath
DVTFilePathFSEvents
DVTFilePathLogMetrics
DVTFileType
DVTFindBar
DVTFirstLaunchPackageInstallationHelper
DVTFontAndColorTheme
DVTInvalidExtension
DVTMacroExpansionParsing
DVTMacroNamepsace
DVTMixIn
DVTNSImageAdditions
DVTNSImage_ImageDeallocations
DVTNSRunLoopAdditions
DVTPlatform
DVTPlugInExtensionFaulting
DVTPlugInLoading
DVTPlugInLocator
DVTPlugInManager
DVTPlugInQuery
DVTPreferenceSetManager
DVTRegularExpression
DVTReplacementView
DVTSDK
DVTSigningCertificate
DVTSigningCertificateManager
DVTSigningCertificateSource
DVTSourceEditorDrawing
DVTSourceEditorFolding
DVTSourceEditorLayout
DVTSourceEditorPerformance
DVTSourceLandmarks
DVTSourceModel
DVTSourceScanner
DVTSourceSpecificationLoading
DVTStateSaving
DVTSystemActivity
DVTTextAnnotation
DVTTextCompletionPerformance
DVTTextCompletionUI
DVTTextResponsivenessPerformance
DVTToolchain
DepCommandTraversal
DepNodeTraversal
Dependencies
DependencyAnalysis
DependencyGraph
DependencyGraphCreation
DependencyGraphCreationMetric
DependencyGraphLock
DependencyIssue
DerivedInfo
DerivedTargetAttributes
DocumentFileTypes
Executable
FSWatcher
FileInfoCaching
FileRefCaching
FileSuffixMapping
FileTypeDetection
GenericOutputParsing
GroupEnumerator
HdrScanning
HeaderScanning
Headermap
HeadermapCreation
Headermaps
IBAutoAttach
IBICPerformanceMetric
IBMessageChannel
IDEActivityLogSection
IDEActivityReportFileIOCoordinator
IDEActivityView
IDEActivityViewIssues
IDEActivityViewStructure
IDEApplicationLaunchPerformance
IDEBatchFindMetric
IDEBatchFindNavigator
IDEBuildAlertMonitor
IDEBuildArbitratorDebug
IDEBuildDebugMetric
IDEBuildIssueProviderLogLoadingPerformance
IDEBuildOnlyMetric
IDEBuildOperationDebug
IDEBuildOperationDependencies
IDEBuildOperationMemorySnapshot
IDEBuildOperationQueueSetResourceManagement
IDEBuildOperationTiming
IDEBuildTaskDebug
IDEBuilderDebug
IDECallHierarchy
IDECallerGenius
IDEClangDiagnostic
IDECodeModule
IDECommandManagerPerformance
IDEContainerDebug
IDEContainerFSEventsDebug
IDEContainerItemSCMDebug
IDEContextAutocreation
IDECounterpartsGeniusResultsFinderPerformance
IDEDeclarativeInspectorGeneratorLoadingPerformanceAspect
IDEDiagnosticController
IDEEditorContextDocumentForNavBarStructureChanged
IDEEditorContextFluidSwipeDebug
IDEEditorContextNavigation
IDEEditorContextObjectGraphCoalescing
IDEEditorCoordinator
IDEEditorDocument
IDEEditorDocumentDebug
IDEEditorDocumentModificationAspect
IDEEditorOpenPerformance
IDEExecutionEnvironmentExecuteOperation
IDEFileReferenceDebug
IDEFileReference_CallingDocumentEditedStateChangedTooOften
IDEFolderDebug
IDEGeniusResults
IDEGeniusResultsPerformance
IDEImplicitDependenciesDebug
IDEIndexDataSourcePerformanceAspect
IDEIndexDatabase
IDEIndexImporterDebug
IDEIndexQP
IDEIndexQuery
IDEIndexSwiftDataSource
IDEIndexing
IDEIndexingASTSize
IDEIndexingClangInvocation
IDEIndexingMetrics
IDEIndexingScheduling
IDEInitialization
IDEIssueManager
IDEKVO
IDEKeyBindings
IDELicenseAgreementViewController
IDELogStore
IDENavigableItem
IDENavigableItemArchivableRepresentation
IDENavigableItemCoordinator
IDENavigatorOutlineViewPerformance
IDENotifications
IDEOpenQuickly
IDEOpenQuicklyMetrics
IDEPackageInstallerHelper
IDEPlaygroundExecutionCoordinator
IDEReadOnlyItemsManager
IDERunContextManager
IDERunContextManagerPerformance
IDERunDestination
IDERunDestinationPerformance
IDESchemeSheetOpening
IDESourceCodeCallersCalleesGeniusResultsFinder
IDESourceCodeIndexGeniusResultsFinder
IDESourceCodeNavigation
IDESourceCodeNavigationPerformance
IDESourceCodeSymbolsColoring
IDESourceCodeSymbolsColoringPerformance
IDESourceControl
IDESourceControlFileScanning
IDESourceControlProfiling
IDESourceControlTaskOperation
IDESourceEditorDropRecomputableState
IDESourceEditorTopLevelStructure
IDESourceKitService
IDESourceLanguageServiceSwift
IDESourceSyntaxColoringPrefetch
IDESyntaxColoringPerformance
IDETestManager
IDETestingHelperDebug
IDETextEncoding
IDETextIndex
IDEUpgradeTaskPerformanceMetric
IDEUtilityAreaPerformanceAspect
IDEVersionedFileManager
IDEWelcomeWindowPerformance
IDEWorkspaceClosing
IDEWorkspaceLoading
IDEWorkspaceUILoading
IndexingInfo
InstantOff
IntegrityChecking
LaunchRunPhase
MessageQueues
Modules
NativeBuilding
OperationStatus
Operations
OptionCategories
PersistedBuildResults
PlatformLoading
Plist
PlugInCompilers
PlugInTools
PluginLoading
PrecompiledHeader
ProfileScheme
ProjectLoading
ProjectLocalization
ProjectReference
ProjectSaving
ProjectTiming
PropertyValue
QuickHelp
RecursiveSearchPaths
RelevantToolSpecs
RunAlerts
SDKLoading
SimplePreprocessor
SourceFileFiltering
SpecificationLoading
SpecificationLoadingTiming
SpecificationsDebug
SupportedBuildTools
TSRegularExpression
Target
TargetCache
TargetCaches
ThreadedOperations
Unarchiving
WorkQueueProcessing
XBS
XCClangResultsPostprocessor
XCGccMakefileDependencies
XCPropertyValue
iPhoneSimulator

有三个日志级别

  1. critical(默认)
  2. 标准
  3. 详细
  4. 要更改日志级别,请将LogLevel附加到方面名称并将其写入Xcode的首选项。例如,要获取有关SDK加载的详细日志,请键入以下命令:

    defaults write com.apple.dt.xcode DVTSDKLogLevel -int 3 && killall -u $USER cfprefsd
    

    要一次更改所有日志级别,请使用DVTDefaultLogLevel首选项。但你可能不想这样做,因为它会很快变得过于冗长。

    如果您不希望永久存储用户默认值,您可以从终端运行Xcode并将用户默认值作为参数传递:

    /Applications/Xcode.app/Contents/MacOS/Xcode -DVTSDKLogLevel 3