4

I am trying to execute CPCMD.EXE command and my requirement is to log the output and error in a file of cpcmd.exe.

But when i am trying to run CPCMD.exe with the invalid user credential instead of giving me Login failure error it is throwing "[ConfigurationErrorsException: The configuration section for Logging cannot be found in the configuration source.]".

So what entry I need to put to resolve the same and in which config?

2

You need to add this section to your app.config:

<!-- Necessary for Tridion Logging --> <section 
name="enterpriseLibrary.ConfigurationSource" 
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Configu 
rationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53"/> 
<section name="loggingConfiguration" 
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Loggin 
gSettings, Microsoft.Practices.EnterpriseLibrary.Logging, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53"/> 
<!-- until here --> 

And then add this config as well:

<!-- Necessary to connect to Tridion --> 
<enterpriseLibrary.ConfigurationSource selectedSource="Tridion Logging"> 
<sources> <clear/> <add name="Tridion Logging" 
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemC 
onfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53"/> 
</sources> </enterpriseLibrary.ConfigurationSource> 
<loggingConfiguration name="Logging Application Block" 
tracingEnabled="true" defaultCategory="General" 
logWarningsWhenNoCategoriesMatch="false"> <listeners> <add name="Tridion 
Console Trace Listener" 
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configur 
ation.CustomTraceListenerData, 
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
traceOutputOptions="None" 
type="Tridion.Logging.TridionConsoleTraceListener, Tridion.Common, 
Version=2.0.139.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
initializeData="" formatter="Trace Text Formatter"/> <add name="Tridion 
Debug Trace Listener" 
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configur 
ation.CustomTraceListenerData, 
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
traceOutputOptions="None" 
type="Tridion.Logging.TridionDebugTraceListener, Tridion.Common, 
Version=2.0.139.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
initializeData="" formatter="Trace Text Formatter"/> <add 
EventLog="Tridion" 
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configur 
ation.CustomTraceListenerData, 
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
traceOutputOptions="None" 
type="Tridion.Logging.TridionEventLogTraceListener, Tridion.Common, 
Version=2.0.139.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
name="Tridion Event Log" initializeData="" formatter="Tridion Text 
Formatter"/> <add fileName="D:\log\Tridion.ContentManager.log" 
header="----------------------------------------" 
footer="----------------------------------------" formatter="" 
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configur 
ation.FlatFileTraceListenerData, 
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
traceOutputOptions="None" 
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatF 
ileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=349a39f202fa9b53" 
name="Tridion CM Log File"/> </listeners> <formatters> <add 
template="{message}" 
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextForma 
tter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=349a39f202fa9b53" name="Trace Text 
Formatter"/> <add template="{message}&#xA;&#xA;Component: 
{keyvalue(component)}&#xA;Errorcode: {keyvalue(errorcode)}&#xA;User: 
{keyvalue(username)}&#xA;&#xA;{keyvalue(stacktrace)}" 
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextForma 
tter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=349a39f202fa9b53" name="Tridion Text 
Formatter"/> </formatters> <categorySources> <add switchValue="All" 
name="General"/> </categorySources> <specialSources> <allEvents 
switchValue="Warning" name="All Events"> <listeners> <add name="Tridion 
Event Log"/> </listeners> </allEvents> <notProcessed switchValue="All" 
name="Unprocessed Category"/> <errors switchValue="All" name="Logging 
Errors &amp; Warnings"/> </specialSources> </loggingConfiguration> <!-- 
until here --> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.