The next one thing tool that we are going to talk about is debug logs so debug logs is one of the most
used hands on board that we use for troubleshooting issues and says force from my own Salesforce experience.
I must say that they know what I face issues and says force the top a second thought I go to debug logs
to check what the issue is.
So that much debug logs have come as a very handy tool for me to solve and troubleshoot many of the
issues that we face during configuration and testing.
Now let's jump into our sales force a developer additions and check out how to configure this awesome
tool.
So go to setup look for debug logs on the logs that you should be able to see debug logs go to debug
logs and the other important thing about these logs is that you can very easily configure debug logs
and you can read your LOC files.
All right.
So what this debug logs debug logs as the name says it is basically a log which is used for debugging
so logs means war logs means it basically records whatever that happens in the background.
Right.
So debug logs also records everything that happens in the background.
And it very much helps you to debugger issues so you feel enabled debug log for a particular user.
The moment you turn it on it starts recording everything that I use that does basically night it starts
recording that.
OK.
So this user has clicked on the icon and stab or does use it has clicked on the opportunity tab and
does use it has created a validation rule out of this use it has created a record this user enabled
the approval process and the user faced this particular error everything.
So if you enabled debug log for a particular user it records everything that they use it doesn't the
application within that particular time frame.
Similarly you can also enable debug logs for Apex classes offered to goes also.
So now let's understand how to configure this debug logs.
In fact we have already discussed about the debug logs in Part 1 of this advanced administrator calls
a while we've an understanding about how to use the debug logs and other techniques to troubleshoot
approval process.
However in this session let's understand even more detail delusion off how to create a debug logs and
how to basically use it perfect.
Now let's go and configure other debug logs.
So first of all how do we get debug logs.
Why no one this debug logs do not get generated by default have that in mind.
Only then we enabled other trace flags only then debug logs will get generated.
You just doesn't get good generated by default.
So first you have to set your trace flags only then you set your trace flags debug logs will get generated
if you'll see here you can see there are no logs assets available here because we have not set any trace
flags for any user or for other components.
So debug logs do not get generated by default.
It gets generated only for that particular time frame and for that particular day you set auto company.
All right.
OK so for enabling that trace flag what do you need to do here you can see user trace flags and there
are a couple of trace flags set and these trace flags if I remember right we did while we were doing
our part one of the scores for troubleshooting approval process but that's OK.
We can read that so far trace flags first.
Create a new stress flag.
So what does increase flag so is flat contains all the details about how a debug log has to be generated.
So first comes that traced entity type so traced entity type.
You see it can be an automated process or a user or Apex class auditory gut so it can be any of these.
If you say user the debug logs will be generated only for a particular user.
Say for example I say they use it as meat.
So the moment I said the strays flag on what happens is more debug logs will get generated for everything
that I do in the salesforce application.
It will say often I go into the account tabs Arsenal created a new account then arson I encountered
an error last June I deleted a particular record everything so whatever I do it will get recorded in
debug logs and if I say that entity is the apex class then debug logs will get generated when this apex
classes tree good or Apex good history good.
So when a lot of these classes in walked are the trigger as trigger only at that time the debug logs
will get generated and that to the debug log will get generated for these components only if it is within
that particular time frame debug logs.
It just doesn't get generated like all the time it gets generated only within the particular time frame.
So if you seek the traced entity type as Apex class and raise flag is set for that particular time then
debug logs are being generated for this class.
Similarly for the trigger similarly for the automated process and also for the user highlights or debug
logs get generated for this particular entity type and for this particular site.
So praised entity type in our case let's say user but if you are working on an apex trigger and you
are interested in only the in the debug logs off that particular tree good very much against edit for
the trigger off of the class awful automated process.
All right so it depends on the requirement on the G entity you would like to set the debug logs for
and now let's do it for user and traced entity name so of envy.
We have no tools are chosen the entity type.
Next let's choose the entity name.
And if you have said to use us so we need to select which user let me choose myself.
And then comes the start date and the expiration date.
So start date on the expiration date.
The maximum can be 24 hours so I've chosen now and then let me choose basically I have chosen 24 hours
next as the debug level while creating a new race flag.
We need to set the debug level so what does that debug diva debug level basically specifies the amount
of information that needs to be logged in the debug logs so or do we want to just the information or
do we want the in-depth details of each and every activity that is being done.
So that is all specified in debug level.
So for creating a trace flag debug level is mandatory.
We see here.
So we need to have debug levels set first and then we need to create trace flags.
And here in our system we already have a debug law debug level created.
But that's okay.
We can create a new debug level to understand it better and we can use that newly created debug level
to create this trace flag.
So for creating a debug level go for debug levels
we see we already have a debug level here.
Let's create a new one so for creating a new label level give a debug level name.
In this case let me say
test debug levy and then you'll need to give the information out here.
The demon levy.
We have the category and also delivered.
So the last category here this is basically the type of information that is logged the database or the
workflow or the validation like that and the levy meaning the amount of information that does log.
So this is the type and this is the amount and then the evens.
So even this is basically the combination of this category and the level.
Say for example here we have three levels.
None means nothing.
So basically there are more evens that are captured in the database level in full some sort of evens
are getting captured finest.
Some more set of evens are getting captured.
So basically in the database level there are many even that happens in the background right.
So we have to set in the debug level what role the type of evens that has to be captured in every category.
So for this DB and database level if you choose none none of the database evens will be captured in
your log.
If you choose in for a little more if you just find list looking more similarly for the other categories
also none none of the workflow really get basically captured in your logs and only the errors only the
warnings only some information.
These are the only workflow evens that we get captured in your logs fine.
The next level some more workflow finer.
Like all of the workflow you will get captured in your logs so basically evens are the combination of
your category and the level that you specified.
So first if you see the database so database meaning it includes the information about database activities
including you are dismal the data manipulation language statements audio.
Yes OK you will SLA queries and all these and workflows workflows includes information for about your
workflow tools flows processes and all these information
validation is about your validation rules call outs meaning it includes the request response X many
that the set said what is sending and receiving from an external Web service Apex scored information
all about apex court it includes a message just which is generated by the demo statements so you will
as always equities the start and the completion of any triggers the start and completion of any test
method and all these apex profiling it includes the profiling information suggests the limits for your
namespace the number of emails that are sent visually us basically includes information about Vishal
for Z wins.
It also includes other serialization and digitalization of the view state or evaluation of a formula
field individual for this page and all such information and the system meaning regular US system methods
are like a system dart debug methods and all these so basically in the debug level you need to say like
which are all the categories I need information about.
And what does the level of information that needs to be captured.
And this may vary depending on a requirement for a particular requirement.
We may be working on a particular category.
So you can set the information as maximum for that particular category say for example you're working
on a validation.
So then set to do full for that validation so that we track all the information regarding to that validation.
All right.
So depending on the requirements you can specify your debug logs accordingly.
So now like you know I have almost a century to find this.
So you know we can know we'll be able to understand how a debug log basically captures the information
and the ones you have set out to debug level.
And I have named it as a test debug level.
Once you have set your debug level everything click on safe.
So perfect.
Now that we have created a new debug level and now that we have created other debug levels let's go
and create this trace flag.
So Trace flag we know for creating a trace lag we need to set up our debug level.
Now we know what a debug level is and how to create them.
So let's choose the debug level the test debug level that we created.
We get it here and you can save your trees flat affect.
We have saved it.
We have saved the trees flat now that we have set this DREs flag for me as they use it from this second
whatever I do in the application everything will be captured in my debug logs.
So now before we actually go I'll go ahead and test how this debug logs work.
I think I didn't know what order they we have no clear on that.
So our debug logs we know it is basically just a recap or debug logs we know it is used for basically
monitoring whatever a person a user does on whatever happens for a particular component it can be an
automated process order apex to good order Apex glass and the for setting a trace flag.
We need to first create a lot of debug levels and we just before a few minutes we understood how to
create a debug level and the daemon level that we create a number on.
We can also see that do multiple trace flags you know agenda and org has a two or three debug levels
and those are debug levels we choose it according to the requirement.
So now that we did not have any debug I mean in case like we had one debug level.
But to understand how to create or debug level we also created another debug level.
And once you create your debug levels you can set your trace flex so step one is to create debug level.
And if your order already has a debug level set you can reuse that debug level and create your trace
flags.
And here you see the trace flag that we just created is the third one right.
This one and these ones were previously created.
So what in real time.
If you go to debug logs you would see many entries like this.
Basically a DB these trace flags we know we can set it only for 24 hours.
So the next time we don't we want to set up our trace flag.
You can either reuse the same thing like you know you can just click on edit and you can just change
the start date and the expiration date and if you want to change it debug level yes you can change it
for this for the same user and click on safe so you can basically to use that call you can delete that
also you can just delete off all the all the end result here.
So I've deleted that I've deleted that those are the all the entries.
So basically whenever we want to debug log to get a generator we create a new trace flag or we can edit
that existing records pointing to the future dates perfect.
Now we have completely understood how to configure our trace flags for debug logs to generate.
And now let's test our debug logs for testing we'll see in our next session how to basically test our
debug logs.