I have changed the logging in PingFederate to log to the database. Not only have I done this for the four log files that have the configuration prepared (audit, provisioner, provisioner_audit & server) I have also added appenders for all other log files with the exception of init.log. They are all logging to the database but there is missing data in most of the logs. My root section looks like the following:
<Root level="INFO" includeLocation="false">
<AppenderRef ref="ServerLogToSQLServerDB-FAILOVER" />
<AppenderRef ref="ProvisionerLogToSQLServerDB-FAILOVER" />
<AppenderRef ref="OutboundProvisionerEventToSQLServerDB-FAILOVER" />
<AppenderRef ref="SecurityAuditToSQLServerDB-FAILOVER" />
<AppenderRef ref="AdminLogToSQLServerDB-FAILOVER" />
<AppenderRef ref="AdminApiLogToSQLServerDB-FAILOVER" />
<AppenderRef ref="RuntimeApiLogToSQLServerDB-FAILOVER" />
<AppenderRef ref="TransactionLogToSQLServerDB-FAILOVER" />
<AppenderRef ref="AdminEventDetailLogToSQLServerDB-FAILOVER" />
</Root>
and my log4j2.db.properties file is also populated (obviously or I wouldn't have anything). I have also turned on the admin-event-detail log and that is logging too. I will use the audit log as an example and the JDBC Appender looks like this:
<JDBC name="SecurityAuditToSQLServerDB" tableName="log_audit" ignoreExceptions="false">
<ConnectionFactory class="com.pingidentity.log4j.LoggingDBConnectionPoolFactory" method="getSQLServerDatabaseConnection" />
<Column name="dtime" isEventTimestamp="true" />
<Column name="event" pattern="%X{event}" />
<Column name="username" pattern="%X{subject}" />
<Column name="ip" pattern="%X{ip}" />
<Column name="app" pattern="%X{app}" />
<Column name="host" pattern="%X{host}" />
<Column name="protocol" pattern="%X{protocol}" />
<Column name="role" pattern="%X{role}" />
<Column name="partnerid" pattern="%X{connectionid}" />
<Column name="status" pattern="%X{status}" />
<Column name="adapterid" pattern="%X{adapterid}" />
<Column name="description" pattern="%X{description}" />
<Column name="responsetime" pattern="%X{responsetime}" />
<Column name="trackingid" pattern="%X{trackingid}" />
</JDBC>
<RollingFile name="SecurityAuditToSQLServerDB-FILE" fileName="${sys:pf.log.dir}/audit-sqlserver-failover.log"
filePattern="${sys:pf.log.dir}/audit-sqlserver-failover.%d{yyyy-MM-dd}.log" >
<PatternLayout>
<pattern>%d | %X{event} | %X{subject} | %X{ip} | %X{app}| %X{host}| %X{protocol} | %X{role} | %X{connectionid} | %X{status}| %X{adapterid} | %X{description}| %X{responsetime} | %X{trackingid}| %n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
<PingFailover name="SecurityAuditToSQLServerDB-FAILOVER" primary="SecurityAuditToSQLServerDB" retryIntervalSeconds="60">
<Failovers>
<AppenderRef ref="SecurityAuditToSQLServerDB-FILE" />
</Failovers>
</PingFailover>
When I check the two different logs (by switching back & forth from the original config file) the database does not have as much data as the file did.
File:
2017-12-14 09:27:23,803| tid:_IJBevZYwaRBmmMzfZ1SZ1VdKtM| AUTHN_ATTEMPT| | 0:0:0:0:0:0:0:1 | | | | <Host name removed>| IdP| inprogress| LoginFormAdapter| | 505
DB:
1 2017-12-14 10:22:10.663 0
I don't know if it is relevant but I have also written a class to override the Jetty logs and they are also logging to the database and seem fine except for the user-agent field.
I suspect that I have interrupted some flow with what I have done but I have no idea what. Does anyone know why or where I am losing this data.
Instead of putting all those AppenderRef's in your Root section, try changing the appropriate Logger section for each type of logger (like IdpAuditLogger, SpAuditLogger, etc.). You may be running into a conflict there with multiple appenders loaded, as per the comment in the file:
Each must be the only appender referenced in the logger org.sourceid.websso.profiles.idp.IdpAuditLogger. If one of these appenders is added, remove the existing reference to "SecurityAudit2File".
And mentioned in the documentation here: https://support.pingidentity.com/s/document-item?bundleId=pingfederate-93&topicId=coj1564002980835.html
Important: As indicated in the IMPORTANT comments for the loggers, you must also remove some of the existing appender references.
Related
I want to add a upload button the start-workflow page and for that i need to add upload component xml tags as follows in template instance:
<component>
<region-id>html-upload</region-id>
<url>/components/upload/html-upload</url>
</component>
<component>
<region-id>flash-upload</region-id>
<url>/components/upload/flash-upload</url>
</component>
<component>
<region-id>file-upload</region-id>
<url>/components/upload/file-upload</url>
</component>
<component>
<region-id>dnd-upload</region-id>
<url>/components/upload/dnd-upload</url>
</component>
<component>
<region-id>archive-and-download</region-id>
<url>/components/download/archive</url>
</component>
Why you wanted to add a upload button to the start-workflow page alfresco OOTB provides the workflow package you can attach your documents here.
You just need to define it in share config
<config evaluator="string-compare" condition="activiti$submitDocument">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="general" appearance="title" label-id="workflow.set.other" />
<field id="packageItems" set="general" label="Purchase request document">
<control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl">
</control>
</field>
</appearance>
</form>
</forms>
</config>
and you can get all the attached document using javascript
var documents = bpm_package.children;
It was as simple and obvious as it could have been. All you need to do is create a file named start-workflow.xml in the directory src/main/resources/alfresco/web-extension/site-data/template-instances. Then just copy paste the original file and add your components. This isn't enough in itself. You also have to add regions of these components to the template of start-workflow. Again, a simple process. Create a file start-workflow.ftl in the directory src/main/resources/alfresco/web-extension/site-data/templates/org/alfresco. Once again copy paste the original file and add your regions. In my case it was :
<#region id="html-upload" scope="template"/>
<#region id="flash-upload" scope="template"/>
<#region id="file-upload" scope="template"/>
<#region id="dnd-upload" scope="template"/>
<#region id="archive-and-download" scope="template"/>
I want to have log messages from each log level go to a different file. From the name, LevelMatchFilter seems like what I want, except it seems to not filter anything from a different level.
I think the following properties should do that using LevelRangeFilter. However, anything sent to the global logger ends up in INFO.log, regardless of the level.
log4j.rootLogger = OFF
# Global level based logs
log4j.logger.global = ALL, Info
log4j.appender.Info=org.apache.log4j.FileAppender
log4j.appender.Info.File=Logs/INFO.log
log4j.appender.Info.layout=org.apache.log4j.PatternLayout
log4j.appender.Info.layout.ConversionPattern=%d [%p] %m%n
log4j.appender.Info.filter.a=org.apache.log4j.filter.LevelRangeFilter
log4j.appender.Info.filter.a.LevelMin=info
log4j.appender.Info.filter.a.LevelMax=info
log4j.appender.Info.filter.a.AcceptOnMatch=true
I also tried using INFO for the values of LevelMin and LevelMax but that had the same results.
What am I doing wrong?
As a side question, is there a way to turn on debugging of the log4cxx configuration when using a property file? I found an option when using an xml file, but none of the obvious translations to properties (debug=true, log4j.debug=true) and any effect.
As of log4cxx 0.10 (and probably earlier), the properties format does not support filters. So the XML configuration (or programmatic configuration) is required.
<?xml version="1.0" encoding="UTF-8" ?>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<appender name="Info" class="org.apache.log4j.FileAppender">
<param name="file" value="Logs/INFO.log" />
<param name="append" value="false" />
<!-- If this filter accepts the message, it will be printed. That happens if this is an info message -->
<filter class="org.apache.log4j.filter.LevelMatchFilter">
<param name="levelToMatch" value="INFO" />
<param name="acceptOnMatch" value="true" />
</filter>
<!-- If it is not an info message, this filter will reject it -->
<filter class="org.apache.log4j.filter.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%p] %m%n" />
</layout>
</appender>
<root>
<priority value="off" />
</root>
<logger name="global">
<priority value="all" />
<appender-ref ref="Info" />
</logger>
</log4j:configuration>
I am trying to define workflow in Alfresco 4.2. I have a type defined as follows:
<type name="abc:start">
<parent>bpm:startTask</parent>
<associations>
<association name="abc:client">
<source>
<mandatory>true</mandatory>
<many>true</many>
</source>
<target>
<class>cm:person</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</type>
This type is used start event of an workflow:
<config evaluator="string-compare" condition="activiti$sa05">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
<show id="abc:client"/>
</field-visibility>
<appearance>
<set id="items" appearance="title" />
<set id="info" appearance="title" />
<field id="packageItems" set="items" />
<field id="abc:client" set="info" />
</appearance>
</form>
</forms>
In the event I have a very simple script (started at end of event), which uses this association:
logger.log("Starting workflow for: " + abc_client);
execution.setVariable("abc:client", abc_client);
When I start workflow for the first time, everything is ok. When I start it for the second time, I get the following error:
Failed to execute supplied script: 01240010 ReferenceError: "abc_client" is not defined. (AlfrescoJS#2)
I set a breakpoint in RhinoScriptProcessor and I was able to see that "abc:client" gets passed to script, rather then "abc_client". Why is it so? Why this isn't deterministic?
It turns out that the following line was problematic:
execution.setVariable("abc:client", abc_client);
Alfresco keeps an internal cache of two-way-mapping: qualified name <-> variable name. On first execution of workflow {abc namespace}client is mapped to abc_client. But then the above line gets executed and now {abc namespace}client is mapped to abc:client. As the result, on the next execution of the workflow abc:client is passed, rather then abc_client.
I'm using FOSUserBundle and I've created a Message table with two columns, that are relating to the User from FOSUserBundle.
I want to get messages and information about the author using one query.
Following schema.xml:
<?xml version="1.0" encoding="UTF-8"?>
<database name="default" namespace="Acme\StoreBundle\Model" defaultIdMethod="native">
<table name="message">
<column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
<column name="title" type="varchar" size="64" required="true" defaultValue="(untitled)"/>
<column name="content" type="longvarchar" />
<column name="author_id" type="integer" required="true" />
<foreign-key foreignTable="fos_user">
<reference local="author_id" foreign="id" />
</foreign-key>
<column name="recipient_id" type="integer" required="true" />
<foreign-key foreignTable="fos_user">
<reference local="recipient_id" foreign="id" />
</foreign-key>
</table>
</database>
I was trying many options, with no result.
When I try, what seems to be logical:
$messages = MessageQuery::create()
->join('Message.Authorid')
->findByRecipientId(1);
I get an error: "Unknown table or alias Message"
With:
->join('Authorid')
Error: "Unknown relation Authorid on the Acme\StoreBundle\Model\Message table"
What am I doing wrong?
Thank you for your help.
Ok, I found it out.
The schema for both author and recipient has to look like:
...
<column name="author_id" type="integer" required="true" />
<foreign-key foreignTable="fos_user" phpName="Author">
<reference local="author_id" foreign="id" />
</foreign-key>
<column name="recipient_id" type="integer" required="true" />
<foreign-key foreignTable="fos_user" phpName="Recipient">
<reference local="recipient_id" foreign="id" />
</foreign-key>
...
The important part is the phpName.
Now the controller. And here is something weird that happens, but it doesn't disturb.
$messages = MessageQuery::create()
->find();
return $this->render('AcmeStoreBundle:Message:index.html.twig',
array('messages' => $messages)
);
And after this easy code, I have access to everything from twig.
At this point I'd like to show an example:
When the controller looks like above, then
# AcmeStoreBundle:Message:index.html.twig
messages
Shows every field of the message table like:
Acme\StoreBundle\Model\Message_0: Id: 1 CreatedAt: !!php/object:O:8:"DateTime":3: {s:4:"date";s:19:"2013-03-20 13:00:00";s:13:"timezone_type";i:3;s:8:"timezone";s:12:"Europe/Paris";} Title: (untitled) Content: 'test content' AuthorId: 1 RecipientId: 2 Acme\StoreBundle\Model\Message_1: Id: 2 CreatedAt: !!php/object:O:8:"DateTime":3:{s:4:"date";s:19:"2013-03-20 13:15:22";s:13:"timezone_type";i:3;s:8:"timezone";s:12:"Europe/Paris";} Title: (untitled2) Content: 'bla bla content 2' AuthorId: 2 RecipientId: 1
As you can see, there is nothing about the relationship with author or recipient, but when I call message.author.username, or message.recipient.username (in the for loop of messages) I'm getting this. And this is what I actually expected.
And now when the controller looks like:
$messages = MessageQuery::create()
->joinWith('Author')
->find();
return $this->render('AcmeStoreBundle:Message:index.html.twig',
array('messages' => $messages)
);
messages (in twig) throws all the fields like above, and an author object (called author, not user, because of phpName from the schema).
Thank you guys for reading my question and many thx for participation.
The join method takes the relation using tables or phpName aliases, not the fields. So you probably want:
->join("Message.Author")
Or, as your foreign key suggests, maybe this?
->join("Message.FosUser")
UPDATE
With two FK references to the same table, you will want to use the phpName and refPhpName attributes of the foreign-key tag:
<table name="message">
...
<foreign-key foreignTable="fos_user" phpName="Author" refPhpName="AuthoredMessage">
<reference local="author_id" foreign="id" />
</foreign-key>
<foreign-key foreignTable="fos_user" phpName="Recipient" refPhpName="ReceivedMessage">
<reference local="recipient_id" foreign="id" />
</foreign-key>
</table>
Then you could try using ->join('Message.Author') or ->join('Message.Recipient')
See the documentation of the foreign-key element.
I'm converting an existing build script from <mxmlc /> to <compc /> to generate a swc.
However, the build is failing, giving the error:
[compc] C:\xxxx\LogViewer.mxml(32): Error: Access of undefined property VERSION.
[compc]
[compc] private static const VERSION:String = CONFIG::VERSION;
In my ant task, I have the following defined:
<compc compiler.as3="true" output="${output.dir}/${swc.name}.swc" incremental="true" fork="true" maxmemory="512m" compiler.show-deprecation-warnings="false">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<source-path path-element="${srcdir}" />
<include-sources dir="${srcdir}" includes="*" />
<external-library-path dir="${swc.libs.dir}" append="true">
<include name="*.swc" />
</external-library-path>
<external-library-path dir="${output.common.swc.dir}" append="true">
<include name="*.swc" />
</external-library-path>
<compiler.define name="CONFIG::VERSION" value="${build.version}" />
<compiler.define name="CONFIG::RELEASE" value="${config.release}" />
<compiler.define name="CONFIG::DEBUG" value="${config.debug}" />
<compiler.define name="CONFIG::AUTOMATION" value="false" />
</compc>
This approach worked fine with the task, but is now failing.
What's the correct way to use compiler constants with compc?
String values need to be put in single quotes. For instance:
<compiler.define name="CONFIG::VERSION" value="'${build.version}'" />
The Flex Ant tasks really are incredibly frustrating, mainly due to the lack of documentation. I struggled with this for a while until I figured it out.
We do something similar in our build, and the only difference I can see is that we don't have the compiler bit:
<define name="CONFIG::build" value="5" />