First I would say that I do NOT recommend to enable any database logging, unless it is business important for you, and you need to have a track of parameter changes.
But in some cases customers demand to have database logging. I agreed and explained that it will have performance consequences, but we could do it on parameters and groups.
But Iβm a type of guy that likes to create scripts to enable things. So I wanted to share with you a small script that enables database logging on all groups and parameters.
(This script is for AX2009)
static void KHA_AddDatabaseLogging(Args _args) { #AOT Name name; TreeNode treeNode; SysDictTable sysDictTable; DatabaseLog DatabaseLog; ; treeNode = TreeNode::findNode(#TablesPath); treeNode = treeNode.AOTfirstChild(); while (treeNode) { name = treeNode.AOTname(); sysDictTable = SysDictTable::newTableId(treeNode.applObjectId()); if ((sysDictTable.tableGroup() == tableGroup::Parameter || sysDictTable.tableGroup() == tableGroup::Group) && !sysDictTable.isMap() && !sysDictTable.isTmp() && !sysDictTable.isView() && sysDictTable.enabled()) { select firstonly DatabaseLog where DatabaseLog.logTable == sysDictTable.id(); if (!DatabaseLog) { DatabaseLog.domainId = "Admin"; DatabaseLog.logType = DatabaseLogType::Update; DatabaseLog.logTable = sysDictTable.id(); DatabaseLog.logField = 0; DatabaseLog.insert(); } info(strfmt("Databaselogging enabled on %1",sysDictTable.name())); } treeNode = treeNode.AOTnextSibling(); } }
Pingback: Enable database logging on groups and parameters | Dynamics Ax 2009
i need Enable database logging on groups and parameters for AX 2012
LikeLike
You need to execute “SysFlushDatabaseLogSetup::main();” after insertion manually databaselog setup if you want that logging start directly. Otherwise, you must restart AOS to flush cache.
LikeLike
Thanks π
LikeLike